@staticmethod
def update_light_states(ego_light, annotations, states, freeze=False,
    timeout=1000000000):
    """
        Update traffic light states
        """
    reset_params = []
    if 'ego' in states:
        prev_state = ego_light.get_state()
        prev_green_time = ego_light.get_green_time()
        prev_red_time = ego_light.get_red_time()
        prev_yellow_time = ego_light.get_yellow_time()
        reset_params.append({'light': ego_light, 'state': prev_state,
            'green_time': prev_green_time, 'red_time': prev_red_time,
            'yellow_time': prev_yellow_time})
        ego_light.set_state(states['ego'])
        if freeze:
            ego_light.set_green_time(timeout)
            ego_light.set_red_time(timeout)
            ego_light.set_yellow_time(timeout)
    if 'ref' in states:
        for light in annotations['ref']:
            prev_state = light.get_state()
            prev_green_time = light.get_green_time()
            prev_red_time = light.get_red_time()
            prev_yellow_time = light.get_yellow_time()
            reset_params.append({'light': light, 'state': prev_state,
                'green_time': prev_green_time, 'red_time': prev_red_time,
                'yellow_time': prev_yellow_time})
            light.set_state(states['ref'])
            if freeze:
                light.set_green_time(timeout)
                light.set_red_time(timeout)
                light.set_yellow_time(timeout)
    if 'left' in states:
        for light in annotations['left']:
            prev_state = light.get_state()
            prev_green_time = light.get_green_time()
            prev_red_time = light.get_red_time()
            prev_yellow_time = light.get_yellow_time()
            reset_params.append({'light': light, 'state': prev_state,
                'green_time': prev_green_time, 'red_time': prev_red_time,
                'yellow_time': prev_yellow_time})
            light.set_state(states['left'])
            if freeze:
                light.set_green_time(timeout)
                light.set_red_time(timeout)
                light.set_yellow_time(timeout)
    if 'right' in states:
        for light in annotations['right']:
            prev_state = light.get_state()
            prev_green_time = light.get_green_time()
            prev_red_time = light.get_red_time()
            prev_yellow_time = light.get_yellow_time()
            reset_params.append({'light': light, 'state': prev_state,
                'green_time': prev_green_time, 'red_time': prev_red_time,
                'yellow_time': prev_yellow_time})
            light.set_state(states['right'])
            if freeze:
                light.set_green_time(timeout)
                light.set_red_time(timeout)
                light.set_yellow_time(timeout)
    if 'opposite' in states:
        for light in annotations['opposite']:
            prev_state = light.get_state()
            prev_green_time = light.get_green_time()
            prev_red_time = light.get_red_time()
            prev_yellow_time = light.get_yellow_time()
            reset_params.append({'light': light, 'state': prev_state,
                'green_time': prev_green_time, 'red_time': prev_red_time,
                'yellow_time': prev_yellow_time})
            light.set_state(states['opposite'])
            if freeze:
                light.set_green_time(timeout)
                light.set_red_time(timeout)
                light.set_yellow_time(timeout)
    return reset_params
