def isValidSubset(subset, background):
    """
    Checks if the gene subset of interest contains genes not present in the background set.
    If there are additional genes they are removed.

    Parameters
    ----------
    subset : set of str
        A subset of Uniprot ACs of interest.
    background : set of str
        A set of Uniprot ACs to be used as the background.

    Returns
    -------
    set of str
        A cleaned subset of Uniprot ACs of interest.
    """

    if subset.issubset(background):
        return subset
    else:
        missing = [AC for AC in subset if AC not in background]
        print('WARNING! The subset of interest contained genes not present in the background list.')
        print(missing)
        print('Removing these genes from the set of interest...\n')
        return subset.difference(missing)