<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def detect_false_positive_direct_metabolites( candidates, biomass_reactions, cytosol, extra, reaction_fluxes, metabolite_fluxes):
 """ Weed out false positive direct metabolites. False positives exists in the extracellular compartment with flux from the cytosolic compartment and are part of the biomass reaction(s). It sums fluxes positively or negatively depending on if direct metabolites in the extracellular compartment are defined as reactants or products in various reactions. Parameters candidates : list of cobra.Metabolite Candidate direct metabolites. biomass_reactions : set of cobra.Reaction The biomass reactions. Usually one or two. cytosol : str The identifier of the cytosolic compartment. extra : str The identifier of the extracellular compartment. Returns ------- list Definitive list of direct metabolites, i.e., biomass precursors that are taken up to be consumed by the biomass reaction only. """

    for met in candidates:
        is_internal = met.compartment != extra
        for rxn in met.reactions:
            if rxn in biomass_reactions:
                continue
            # Internal metabolites can not be false positives.
            if is_internal:
                metabolite_fluxes[met] += abs(reaction_fluxes[rxn])
                continue
            # if the metabolite is in the "e" compartment and a reactant,
            # sum the fluxes accordingly (outward=negative, inward=positive)
            if met in rxn.reactants:
                product_comps = set([p.compartment for p in rxn.products])
                # if the reaction has no product (outward flux)
                if len(product_comps) == 0:
                    metabolite_fluxes[met] += -reaction_fluxes[rxn]
                # if the reaction has a product in "c" (inward flux)
                elif cytosol in product_comps:
                    metabolite_fluxes[met] += reaction_fluxes[rxn]
            # if the metabolite is in the "e" compartment and a product,
            # sum the fluxes accordingly (outward=negative, inward=positive)
            elif met in rxn.products:
                reactant_comps = set([p.compartment for p in rxn.reactants])
                # if the reaction has no reactant (inward flux)
                if len(reactant_comps) == 0:
                    metabolite_fluxes[met] += reaction_fluxes[rxn]
                # if the reaction has a reactant in "c" (outward flux)
                elif cytosol in reactant_comps:
                    metabolite_fluxes[met] += -reaction_fluxes[rxn]
    return [m for m, f in iteritems(metabolite_fluxes) if f > 0]