code: def main():
      args = parse_args()
  
      # TODO: refactor with constituency_parser?
      if "_" in args["retag_package"]:
          lang, package = args["retag_package"].split("_", 1)
      else:
          lang = args["lang"]
          package = args["retag_package"]
      retag_pipeline = Pipeline(
          lang=lang,
          processors="tokenize, pos",
          tokenize_pretokenized=True,
          package={"pos": package},
          pos_tqdm=True,
      )
  
      train_trees = tree_reader.read_treebank(args["input_file"])
      logger.info(
          "Retagging %d trees using %s_%s",
          len(train_trees),
          lang,
          package,
      )
      train_trees = retag_trees(
          train_trees, retag_pipeline, args["retag_xpos"]
      )
      tree_format = "{:L}" if args["bracket_labels"] else "{}"
      with open(args["output_file"], "w") as fout:
          for tree in train_trees:
              fout.write(tree_format.format(tree))
              fout.write("\n")
  
imports: import argparse
  import logging
  from stanza import Pipeline
  from stanza.models.constituency import tree_reader
  from stanza.models.constituency.utils import retag_trees
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types