def clean_up_datetime(obj_map):
clean_map = {}<EOL>for key, value in obj_map.items():<EOL><INDENT>if isinstance(value, datetime.datetime):<EOL><INDENT>clean_map[key] = {<EOL>'<STR_LIT>': value.year,<EOL>'<STR_LIT>': value.month,<EOL>'<STR_LIT>': value.day,<EOL>'<STR_LIT>': value.hour,<EOL>'<STR_LIT>': value.minute,<EOL>'<STR_LIT>': value.second,<EOL>'<STR_LIT>': value.microsecond,<EOL>'<STR_LIT>': value.tzinfo<EOL>}<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>clean_map[key] = clean_up_datetime(value)<EOL><DEDENT>elif isinstance(value, list):<EOL><INDENT>if key not in clean_map:<EOL><INDENT>clean_map[key] = []<EOL><DEDENT>if len(value) > <NUM_LIT:0>:<EOL><INDENT>for index, list_value in enumerate(value):<EOL><INDENT>if isinstance(list_value, dict):<EOL><INDENT>clean_map[key].append(clean_up_datetime(list_value))<EOL><DEDENT>else:<EOL><INDENT>clean_map[key].append(list_value)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>clean_map[key] = value<EOL><DEDENT><DEDENT>else:<EOL><INDENT>clean_map[key] = value<EOL><DEDENT><DEDENT>return clean_map<EOL>
convert datetime objects to dictionaries for storage