def get_original_keys(keys, keymap, strict=False):
    """
    Get original keys from normalized keys.

    Args:
        keys:
            The collection of keys that identify a value in the dataset.
        keymap:
            The keymap returned from :meth:`load` or :meth:`loads`.
        strict:
            If true, a KeyError will be raised if the given keys are not found
            in the keymap.  Otherwise, the given key will be returned rather
            than the original key.  This is helpful when reporting errors on
            required keys that do not exist in the data set.  Since they are
            not in the dataset, no original key is available.

    Returns:
        A tuple containing the original keys names.
    """
    original_keys = []
    for i in range(len(keys)):
        try:
            loc = keymap[tuple(keys[:i+1])]
            line = loc.key_line
            original_keys.append(line.key)
        except AttributeError:
            # this occurs normally for list indexes
            original_keys.append(keys[i])
        except (KeyError, IndexError):
            if strict:
                raise
            original_keys.append(keys[i])
    return tuple(original_keys)