import collections


def __label_units(units_dict, unit_id_dict):
    """Remaps the keys of dictionary to their label in another dictionary

        Args:
            units_dict (dict):      Dictionary of unit_ids to steps_when_seen.
            unit_id_dict (dict):    Dictionary of unit_ids to unit_labels.
        
        Returns:
            Dictionary: { unit_id : step_when_seen } <int> : <int>

        Example:
        With a dictionary of {... 43 : "Viking" ... }
        we would remap a units_dict of:
            { ... 43 : 800 ... } to { ... "Viking" : 800 ... }
    """
    labeled_units_seen_dict = collections.OrderedDict()
    for unit_id, step in units_dict.items():
        label = unit_id_dict[int(unit_id)]
        labeled_units_seen_dict[label] = step

    return labeled_units_seen_dict