def parse_time(time):
    """returns the number of seconds since midnight
    
    Examples:
        parse_time("01:00") = 3600
        parse_time("13:30") = 48600
        parse_time("13:30:10") = 48610"""

    a = time.split(':')
    if len(a) == 2:
        return (int(a[0]) * 60 + int(a[1])) * 60
    elif len(a) == 3:
        return (int(a[0]) * 60 + int(a[1])) * 60 + int(a[2])
    else:
        raise ValueError("unknown format", time, "expected something like 13:30 or 13:30:10")