code: def parse_args():
      """Parse input arguments."""
      parser = argparse.ArgumentParser(
          description="Convert annotations for"
          "text recognition tasks in MMOCR 0.x into the latest openmmlab format."
      )
      parser.add_argument(
          "in_path", help="The path to legacy recognition data file"
      )
      parser.add_argument(
          "out_path", help="The output json path in openmmlab format"
      )
      parser.add_argument(
          "--format",
          choices=["txt", "jsonl", "lmdb"],
          type=str,
          default="txt",
          help="Legacy data format",
      )
      args = parser.parse_args()
      if args.out_path.split(".")[-1] != "json":
          raise ValueError("The output path must be a json file.")
      return args
  
imports: import argparse
  import json
  from typing import List, Tuple
  from mmocr.datasets import RecogLMDBDataset
  from mmocr.utils import StringStripper, dump_ocr_data, recog_anno_to_imginfo
label_desc: Use image node_id 2 for calling a global function with example usage: parse_args() and returns: args