import itertools


def _get_tag_dict(elements):
    """
    Internal helpfer function for Tersoff and ABOP potentials.
    Uses a list of elements strings to return a dict of all tags and if these tags need 2 and 3 body parameters (True)
    or only 3 body parameters (False).
    F.e. ["Si", "C"] returns:
        {'SiSiSi': True,
        'SiSiC': False,
        'SiCSi': False,
        'SiCC': True,
        'CSiSi': True,
        'CSiC': False,
        'CCSi': False,
        'CCC': True}

    Args:
        list[str]: list of elements

    Returns:
        dict[dict]: elemen tags and 
    """
    tags = {}
    tag_list = list(itertools.product(elements, repeat=3))
    for l in tag_list:
        k = "".join(l)
        if l[1] == l[2]:
            tags[k] = True # True if 2 and 3 body
        else:
            tags[k] = False # False if only 3 body
    return tags