(value)
return int(value)
>>> parse_time(10)
    10

    >>> parse_time('05:10') #5*60+10
    310

    >>> parse_time('1:05:10') #60*60+5*60+10
    3910
>>> parse_time(10)
    10
>>> parse_time ( 10 ) 10
def parse_time(value):
    """
    >>> parse_time(10)
    10

    >>> parse_time('05:10') #5*60+10
    310

    >>> parse_time('1:05:10') #60*60+5*60+10
    3910
    """
    if value is None:
        raise ValueError("None value in parse_time")

    if isinstance(value, int):
        # Don't need to parse already-converted time value
        return value

    if value == "":
        raise ValueError("Empty valueing in parse_time")

    for format in ("%H:%M:%S", "%M:%S"):
        try:
            t = time.strptime(value, format)
            return t.tm_hour * 60 * 60 + t.tm_min * 60 + t.tm_sec
        except ValueError as e:
            continue

    return int(value)
def parse_time ( value ) : if value is None : raise ValueError ( "None value in parse_time" ) if isinstance ( value , int ) : # Don't need to parse already-converted time value return value if value == "" : raise ValueError ( "Empty valueing in parse_time" ) for format in ( "%H:%M:%S" , "%M:%S" ) : try : t = time . strptime ( value , format ) return t . tm_hour * 60 * 60 + t . tm_min * 60 + t . tm_sec except ValueError as e : continue return int ( value )