code: def __to_localdatetime(val):
      
      try:
          dt = datetime.strptime(val, __DATE_FORMAT)
          dt = pytz.timezone(__TIMEZONE).localize(dt)
          return dt
      except (ValueError, TypeError):
          return None
docs: Convert val into a local datetime for tz Europe/Amsterdam.