def populate_ast_nsarg_defaults(ast, belast, species_id=None):
if isinstance(ast, NSArg):<EOL><INDENT>given_term_id = "<STR_LIT>".format(ast.namespace, ast.value)<EOL>r = bel.terms.terms.get_normalized_terms(given_term_id)<EOL>ast.canonical = r["<STR_LIT>"]<EOL>ast.decanonical = r["<STR_LIT>"]<EOL>r = bel.terms.terms.get_terms(ast.canonical)<EOL>if len(r) > <NUM_LIT:0>:<EOL><INDENT>ast.species_id = r[<NUM_LIT:0>].get("<STR_LIT>", False)<EOL>ast.species_label = r[<NUM_LIT:0>].get("<STR_LIT>", False)<EOL><DEDENT>if ast.species_id and species_id is None:<EOL><INDENT>species_id = ast.species_id<EOL>belast.species.add((ast.species_id, ast.species_label))<EOL><DEDENT>elif ast.species_id and species_id and species_id != ast.species_id:<EOL><INDENT>belast.species_id = False<EOL>belast.species_label = False<EOL><DEDENT><DEDENT>if hasattr(ast, "<STR_LIT:args>"):<EOL><INDENT>for arg in ast.args:<EOL><INDENT>populate_ast_nsarg_defaults(arg, belast, species_id)<EOL><DEDENT><DEDENT>return ast<EOL>
Recursively populate NSArg AST entries for default (de)canonical values

    This was added specifically for the BEL Pipeline. It is designed to
    run directly against ArangoDB and not through the BELAPI.

    Args:
        ast (BEL): BEL AST

    Returns:
        BEL: BEL AST