def parse_date(txt): if not txt: return None try: return datetime.strptime(txt, '%Y-%m-%d %H:%M:%S') except ValueError: ipdb.set_trace()