import itertools


def get_chemical_gene_combinations(_dict_):
    """
    Parameters
    ----------
    _dict_ : dictionary
        Dictionary with annotated entities. Keys: PMID, Values: another
        dictionary with keys 'chemicals' and 'genes' and value the 
        annotation mark

    Returns
    -------
    combinations : dictionary
        PMIDs as keys, all possible CHEMICAL-GENE combinations are values.
    NCOMB : int
        DESCRIPTION.

    """

    combinations = {}
    NCOMB = 0
    for pmid, entities in _dict_.items():
        chem = entities['chemicals']
        genes = entities['genes']
        combinations[pmid] = list(itertools.product(chem, genes))
        NCOMB = NCOMB + len(combinations[pmid] )
    return combinations, NCOMB