code: def _simpleparsefun(date):
      
      if hasattr(date, 'year'):
          return date
      try:
          date = datetime.datetime.strptime(date, '%Y-%m-%d')
      except ValueError:
          date = datetime.datetime.strptime(date, '%Y-%m-%d %H:%M:%S')
      return date
docs: Simple date parsing function