def validate_datetime(value):
    if isinstance(value, datetime.datetime):
        return value

    for format_ in date_formats:
        try:
            return datetime.datetime.strptime(value, format_)
        except __HOLE__:
            pass
    raise ValidationError("Invalid date format: %s" % value)
dataset/ETHPy150Open dnephin/PyStaticConfiguration/staticconf/validation.py/validate_datetime