<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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