def get_time_parts_from_string(time_string):
    """Extract and return hh, mm, ss from a string of form hh:mm or hh:mm:ss.

    hh refers to two-digit hour, mm : two-digit minute, ss : two-digit second
    """
    hour = int(time_string[0:2])
    minute = int(time_string[3:5])
    second = int(time_string[6:8]) if len(time_string.strip()) == 7 else 0
    return hour, minute, second
