import itertools


def get_entries_in_chemsy(entries_dict, elements):
    """
    Args:
        entries_dict(dict): hashtable of entries pool
                    The key of the dict should be
                    "-".join(sorted(elements))
        elements(list): list of elements included in
                    the chemical space
                    eg. ['Ca', 'O']
    Returns:
        entries(list):
                    list of entries in the chemical
                    space from provided entries

    """
    entries = []
    for i in range(len(elements)):
        for els in itertools.combinations(elements, i + 1):
            key = '-'.join(sorted(els))
            if key not in entries_dict:
                continue
            entries.extend(entries_dict[key])
    return entries