Writes out data from `taxon` to the `output` stream to demonstrate
    the attributes of a taxon object.
    (currently some lines are commented out until the web-services call returns more info. See:
        https://github.com/OpenTreeOfLife/taxomachine/issues/85
    ).
    If `include_anc` is True, then ancestor information was requested (so a None parent is only
        expected at the root of the tree)

def write_taxon_info(taxon, include_anc, output):
    """Writes out data from `taxon` to the `output` stream to demonstrate
    the attributes of a taxon object.
    (currently some lines are commented out until the web-services call returns more info. See:
        https://github.com/OpenTreeOfLife/taxomachine/issues/85
    ).
    If `include_anc` is True, then ancestor information was requested (so a None parent is only
        expected at the root of the tree)
    """
    output.write(u'Taxon info for OTT ID (ot:ottId) = {}\n'.format(taxon.ott_id))
    output.write(u'    name (ot:ottTaxonName) = "{}"\n'.format(taxon.name))
    if taxon.synonyms:
        output.write(u'    known synonyms: "{}"\n'.format('", "'.join(taxon.synonyms)))
    else:
        output.write(u'    known synonyms: \n')
    output.write(u'    OTT flags for this taxon: {}\n'.format(taxon.flags))
    output.write(u'    The taxonomic rank associated with this name is: {}\n'.format(taxon.rank))
    output.write(
        u'    The (unstable) node ID in the current taxomachine instance is: {}\n'.format(taxon.taxomachine_node_id))
    if include_anc:
        if taxon.parent is not None:
            output.write(u'Taxon {c} is a child of {p}.\n'.format(c=taxon.ott_id, p=taxon.parent.ott_id))
            write_taxon_info(taxon.parent, True, output)
        else:
            output.write('uTaxon {c} is the root of the taxonomy.'.format(c=taxon.ott_id))