from functools import reduce
from operator import getitem


def get_key_by_path(tree, keys):
    """
    Function to get keys from a tree by path.

    Parameters
    ----------
    tree        : dict
                  Instance containing the keys
    keys        : Multiple
                  Key to be extracted

    Returns
    -------
    keys        : Multiple
                  Path extracted key
    """
    return reduce(getitem, keys, tree)