def METHOD_NAME(obj):
    """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)
    Illegal values are raise DataError
    """
    if isinstance(obj, (bytes, bytearray)):
        obj = obj.decode('ascii')
    try:
        time_obj = datetime.datetime.strptime(obj, '%Y-%m-%d %H:%M:%S')
        return time_obj
    except Exception as err:
        raise DataError("Not valid datetime struct: %s" % err)