def dict_to_object(item, object_name):
fields = item.keys()<EOL>values = item.values()<EOL>return json.loads(json.dumps(item),<EOL>object_hook=lambda d:<EOL>namedtuple(object_name, fields)(*values))<EOL>
Converts a python dict to a namedtuple, saving memory.