def filter_lobster_by_elements(e1, e2, ILOBSTER):
    """
    Get the filtered ICOHPLIST or ICOOPLIST, by the constituting elements.

    Parameters
    ----------
    e1, e2: string
        element symbols. Order doesn't matter
    ILOBSTER: pandas dataframe of ICOHPLIST or ICOOPLIST

    Returns
    ----------
    a filtered pandas dataframe by elements
    """
    e1_regex = '^' + e1 + '\d+$'
    e2_regex = '^' + e2 + '\d+$'
    mask = ((ILOBSTER['atomMU'].str.contains(e1_regex) & ILOBSTER['atomNU'].str.contains(e2_regex)) | \
            (ILOBSTER['atomNU'].str.contains(e1_regex) & ILOBSTER['atomMU'].str.contains(e2_regex)))
    return ILOBSTER[mask]