<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def orthologize(ast, bo, species_id: str):
 """Recursively orthologize BEL Entities in BEL AST using API endpoint NOTE: - will take first ortholog returned in BEL.bio API result (which may return more than one ortholog) Args: ast (BEL):
 BEL AST endpoint (str):
 endpoint url with a placeholder for the term_id Returns: BEL: BEL AST """


    # if species_id == 'TAX:9606' and str(ast) == 'MGI:Sult2a1':
    #     import pdb; pdb.set_trace()

    if not species_id:
        bo.validation_messages.append(
            ("WARNING", "No species id was provided for orthologization")
        )
        return ast

    if isinstance(ast, NSArg):
        if ast.orthologs:
            # log.debug(f'AST: {ast.to_string()}  species_id: {species_id}  orthologs: {ast.orthologs}')
            if ast.orthologs.get(species_id, None):
                orthologized_nsarg_val = ast.orthologs[species_id]["decanonical"]
                ns, value = orthologized_nsarg_val.split(":")
                ast.change_nsvalue(ns, value)
                ast.canonical = ast.orthologs[species_id]["canonical"]
                ast.decanonical = ast.orthologs[species_id]["decanonical"]
                ast.orthologized = True
                bo.ast.species.add(
                    (species_id, ast.orthologs[species_id]["species_label"])
                )
            else:
                bo.ast.species.add((ast.species_id, ast.species_label))
                bo.validation_messages.append(
                    ("WARNING", f"No ortholog found for {ast.namespace}:{ast.value}")
                )
        elif ast.species_id:
            bo.ast.species.add((ast.species_id, ast.species_label))

    # Recursively process every NSArg by processing BELAst and Functions
    if hasattr(ast, "args"):
        for arg in ast.args:
            orthologize(arg, bo, species_id)

    return ast