def METHOD_NAME(val):
    if isinstance(val, datetime):
        return val.date()
    elif isinstance(val, str):
        return dateutil.parser.parse(val).date()
    elif val is None:
        return None
    else:
        raise ValueError("{} is not parsable as a date!".format(val.type))