def time(value):
    time_val = dt_util.parse_time(value)

    if time_val is None:
        raise vol.Invalid('Invalid time specified: {}'.format(value))

    return time_val
Validate time.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/helpers/config_validation.py/time