def timecode_to_milliseconds(code):
    """ Takes a time code and converts it into an integer of milliseconds.
    """
    elements = code.replace(",", ".").split(":")
    assert(len(elements) < 4)
    
    milliseconds = 0
    if len(elements) >= 1:
        milliseconds += int(float(elements[-1]) * 1000)
    if len(elements) >= 2:
        milliseconds += int(elements[-2]) * 60000
    if len(elements) >= 3:
        milliseconds += int(elements[-3]) * 3600000
    
    return milliseconds