def get_normalized_term(term_id: str, equivalents: list, namespace_targets: dict) -> str:
    """Get normalized term"""

    if equivalents and len(equivalents) > 0:
        for start_ns in namespace_targets:
            if re.match(start_ns, term_id):
                for target_ns in namespace_targets[start_ns]:
                    for e in equivalents:
                        if e and target_ns in e["namespace"] and e["primary"]:
                            normalized_term = e["term_id"]
                            return normalized_term

    return term_id
Get normalized term