def getIsotopeFraction(concentrationDict,labeledDict,unlabeledDict, reverse_labels=False):
    """
    Calculates and returns the fraction of atoms which are labeled in the set of
    isotopolougues.
    
    if reverse_labels is given, then it returns the fraction unlabeled atoms.
    """

    numerator = 0
    denominator = 0
    for spec, conc in concentrationDict.iteritems():
        numerator += conc * labeledDict[spec]
        denominator += conc * (unlabeledDict[spec] + labeledDict[spec])

    if reverse_labels:
        return 1. - numerator / denominator
    return numerator / denominator