def find_tax_id(lineage, valids, ranks):
    """Return the most taxonomic specific tax_id available for the given
    Series.  If a tax_id is already present in valids then return None.
    """
    lineage = lineage[ranks]
    lineage = lineage[~lineage.isnull()]
    found = lineage.head(n=1)
    key = found.index.values[0]
    value = found.values[0]
    return value if value not in valids[key].unique() else None
