def create_descendant_taxon(taxon_id, rank, name, closest_taxon):
    """Set taxon and lineage information for a descendant taxon."""
    desc_taxon = {
        "_id": "taxon_id-%s" % taxon_id,
        "_source": {
            "taxon_id": taxon_id,
            "taxon_rank": rank,
            "scientific_name": name,
            "parent": closest_taxon["_source"]["taxon_id"],
            "taxon_names": [{"class": "scientific name", "name": name}],
        },
    }
    lineage = [
        {
            "node_depth": 1,
            "taxon_id": closest_taxon["_source"]["taxon_id"],
            "taxon_rank": closest_taxon["_source"]["taxon_rank"],
            "scientific_name": closest_taxon["_source"]["scientific_name"],
        }
    ]
    if "lineage" in closest_taxon["_source"]:
        for ancestor in closest_taxon["_source"]["lineage"]:
            lineage.append(
                {
                    "taxon_id": ancestor["taxon_id"],
                    "taxon_rank": ancestor["taxon_rank"],
                    "scientific_name": ancestor["scientific_name"],
                    "node_depth": ancestor["node_depth"] + 1,
                }
            )
    desc_taxon["_source"]["lineage"] = lineage
    return desc_taxon