def _parse(dt, fmt):
    """attempt to coerce dt into a datetime given fmt, otherwise raise
    a FilterValidationError"""
    try:
        dt = datetime.strptime(dt, fmt)
    except TypeError:
        if not isinstance(dt, datetime):
            raise FilterValidationError('Must be a datetime object')
    except __HOLE__ as e:
        raise FilterValidationError(e)
    return dt
dataset/ETHPy150Open django-silk/silk/silk/request_filters.py/_parse