def validate_time(value):
    if isinstance(value, datetime.time):
        return value

    for format_ in time_formats:
        try:
            return datetime.time(*time.strptime(value, format_)[3:6])
        except ValueError:
            pass
    raise ValidationError("Invalid time format: %s" % value)
dataset/ETHPy150Open dnephin/PyStaticConfiguration/staticconf/validation.py/validate_time/original