<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def crosstalk_correction(pathway_definitions, random_seed=2015, gene_set=set(), all_genes=True, max_iters=1000):
 """A wrapper function around the maximum impact estimation algorithm. Parameters pathway_definitions : dict(str -> set(str)) The original pathway definitions. A pathway (key) is defined by a set of genes (value). random_seed : int (default=2015) Sets the numpy random seed gene_set : set(str) (default=set()) Donato et al. (2013) uses this algorithm to remove crosstalk from definitions in case-control studies. Here, `gene_set` is equivalent to the DE (differentially expressed) genes they refer to in their paper. Because crosstalk removal is a preprocessing step applicable to pathway analyses in general, we keep the variable name nonspecific. all_genes : bool (default=True) This value is checked if `gene_set` is not empty. If False, crosstalk correction is only applied to annotations in the `gene_set`. max_iters : int (default=1000) The maximum number of expectation-maximization steps to take in the maximum impact estimation algorithm. Returns dict(str -> tup(set(str), set(str))), where the (str) keys are the pathway names. tup[0] : crosstalk-correction applied to genes in the pathway definition that are also in `gene_set` tup[1] : - `all_genes` is True. Correction is applied to genes outside of `gene_set`. - `all_genes` is False. The second element in the tuple is all genes remaining in the original definition (definition - `gene_set`). """

    np.random.seed(seed=random_seed)

    genes_in_pathway_definitions = set.union(*pathway_definitions.values())
    pathway_column_names = index_element_map(pathway_definitions.keys())

    corrected_pathway_defns = {}
    if gene_set:
        gene_set = gene_set & genes_in_pathway_definitions
        if not gene_set and not all_genes:
            print("`gene_set` parameter was {0}, returning original"
                  "pathway definitions".format(gene_set))
            for pathway, definition in pathway_definitions.items():
                corrected_pathway_defns[pathway] = (set(), definition)
            return pathway_definitions

        corrected_pathway_defns = _apply_correction_on_genes(
            gene_set, pathway_column_names, pathway_definitions)

        # crosstalk correction is _only_ applied to `gene_set`
        if not all_genes:
            for pathway, definition in pathway_definitions.items():
                if pathway not in corrected_pathway_defns:
                    corrected_pathway_defns[pathway] = set()
                gene_set_defn = corrected_pathway_defns[pathway]
                remaining_defn = definition - gene_set
                corrected_pathway_defns[pathway] = (
                    gene_set_defn, remaining_defn)
            return corrected_pathway_defns

    remaining_genes = genes_in_pathway_definitions - gene_set
    if not remaining_genes:
        for pathway, definition in corrected_pathway_defns.items():
            corrected_pathway_defns[pathway] = (definition, set())
        return corrected_pathway_defns

    pathway_remaining_defns = _apply_correction_on_genes(
        remaining_genes, pathway_column_names, pathway_definitions)

    for pathway, definitions in pathway_definitions.items():
        if pathway not in corrected_pathway_defns:
            corrected_pathway_defns[pathway] = set()

        if pathway not in pathway_remaining_defns:
            pathway_remaining_defns[pathway] = set()

        corrected_pathway_defns[pathway] = (
            corrected_pathway_defns[pathway],
            pathway_remaining_defns[pathway])
    return corrected_pathway_defns