def convert_timestamps(obj):
for key in ('<STR_LIT:date>', '<STR_LIT>', '<STR_LIT:end>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>value = obj.get(key)<EOL>if value:<EOL><INDENT>try:<EOL><INDENT>obj[key] = _timestamp_to_dt(value)<EOL><DEDENT>except TypeError:<EOL><INDENT>raise TypeError("<STR_LIT>" % (key, value))<EOL><DEDENT><DEDENT><DEDENT>for key in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>for child in obj.get(key, []):<EOL><INDENT>convert_timestamps(child)<EOL><DEDENT><DEDENT>return obj<EOL>
Convert unix timestamps in the scraper output to python datetimes
so that they will be saved properly as Mongo datetimes.