def get_taxon_xml(tax_profile, taxid, offset, metric='efpkg'):
    """Returns XML node for a phylogenetic tree node and all its children

    Args:
        tax_profile (:obj:TaxonomyProfile): taxonomy profile
        taxid (str): taxonomy identifier of a node of interest
        offset (int): number of starting tabs
        metric (str): scoring metric (default value 'efpkg')

    Returns:
        ret_val (str): XML node
    """
    if taxid not in tax_profile.tree.data:
        raise KeyError(taxid, 'not found in the tree!!!')
    ret_val = '\t'*offset + '<node name="' + tax_profile.tree.data[taxid].name + '">\n'
    offset += 1
    if tax_profile.tree.data[taxid].attributes:
        if metric != 'readcount':
            ret_val += '\t'*offset + '<readcount><val>' + format(
                tax_profile.tree.data[taxid].attributes['count'], "0.0f"
            ) + '</val></readcount>\n'
        ret_val += '\t'*offset + '<' + metric + '><val>' + format(
            tax_profile.tree.data[taxid].attributes[metric], "0.2f"
        ) + '</val></' + metric + '>\n'
        ret_val += '\t'*offset + '<identity><val>' + format((
            tax_profile.tree.data[taxid].attributes['identity']
            / tax_profile.tree.data[taxid].attributes['hit_count']
        ), "0.1f") + '</val></identity>\n'
    else:
        if metric != 'readcount':
            ret_val += '\t'*offset + '<readcount><val>0</val></readcount>\n'
        ret_val += '\t'*offset + '<' + metric + '><val>0.0</val></' + metric + '>\n'
        ret_val += '\t'*offset + '<identity><val>0.0</val></identity>\n'

    if tax_profile.tree.data[taxid].children:
        for child_taxid in tax_profile.tree.data[taxid].children:
            ret_val += get_taxon_xml(tax_profile, child_taxid, offset, metric)
    offset -= 1
    ret_val += '\t'*offset + '</node>\n'
    return ret_val