code: def convert_datetime(obj):
      
      if not PY2 and isinstance(obj, (bytes, bytearray)):
          obj = obj.decode('ascii')
  
      m = DATETIME_RE.match(obj)
      if not m:
          return convert_date(obj)
  
      try:
          groups = list(m.groups())
          groups[-1] = _convert_second_fraction(groups[-1])
          return datetime.datetime(*[ int(x) for x in groups ])
      except ValueError:
          return convert_date(obj)
docs: Returns a DATETIME or TIMESTAMP column value as a datetime object:
  
        >>> datetime_or_None('2007-02-25 23:06:20')
        datetime.datetime(2007, 2, 25, 23, 6, 20)
        >>> datetime_or_None('2007-02-25T23:06:20')
        datetime.datetime(2007, 2, 25, 23, 6, 20)
  
      Illegal values are returned as None:
  
        >>> datetime_or_None('2007-02-31T23:06:20') is None
        True
        >>> datetime_or_None('0000-00-00 00:00:00') is None
        True