@stmt.command()<EOL>@click.option(<EOL>"<STR_LIT>",<EOL>help='<STR_LIT>',<EOL>)<EOL>@click.option("<STR_LIT>", help="<STR_LIT>")<EOL>@click.option("<STR_LIT>", help="<STR_LIT>")<EOL>@click.option(<EOL>"<STR_LIT>",<EOL>help="<STR_LIT>",<EOL>)<EOL>@click.argument("<STR_LIT>")<EOL>@pass_context<EOL>def canonicalize(ctx, statement, namespace_targets, version, api, config_fn):
if config_fn:<EOL><INDENT>config = bel.db.Config.merge_config(ctx.config, override_config_fn=config_fn)<EOL><DEDENT>else:<EOL><INDENT>config = ctx.config<EOL><DEDENT>if namespace_targets:<EOL><INDENT>namespace_targets = json.loads(namespace_targets)<EOL><DEDENT>namespace_targets = utils.first_true(<EOL>[namespace_targets, config.get("<STR_LIT>")], None<EOL>)<EOL>api = utils.first_true([api, config.get("<STR_LIT>", None)], None)<EOL>version = utils.first_true([version, config.get("<STR_LIT>", None)], None)<EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>".format(version))<EOL>print("<STR_LIT>".format(api))<EOL>print("<STR_LIT>")<EOL>bo = BEL(version=version, endpoint=api)<EOL>bo.parse(statement).canonicalize(namespace_targets=namespace_targets)<EOL>if bo.ast is None:<EOL><INDENT>print(bo.original_bel_stmt)<EOL>print(bo.parse_visualize_error)<EOL>print(bo.validation_messages)<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>", bo.original_bel_stmt)<EOL>print("<STR_LIT>", bo.ast)<EOL>if bo.validation_messages:<EOL><INDENT>print(bo.validation_messages)<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT><DEDENT>return<EOL>
Canonicalize statement

    Target namespaces can be provided in the following manner:

        bel stmt canonicalize "<BELStmt>" --namespace_targets '{"HGNC": ["EG", "SP"], "CHEMBL": ["CHEBI"]}'
            the value of target_namespaces must be JSON and embedded in single quotes
            reserving double quotes for the dictionary elements