code: def parse_legacy_data(
      in_path: str, format: str
  ) -> Tuple[List[str], List[str]]:
      """Load legacy data and return a list of file paths and labels.
  
      Args:
          in_path (str): Path to annotation file.
          format (str): Annotation format. Choices are 'txt', 'json' and 'lmdb'.
              For 'lmdb' format, the lmdb file should only contains labels. For
              lmdb file with labels and images, the conversion is unnecessary.
      Returns:
          tuple(list[str], list[str]): File paths and labels.
      """
      file_paths = []
      labels = []
      strip_cls = StringStripper()
      if format == "lmdb":
          dataset = RecogLMDBDataset(
              in_path,
              parser_cfg=dict(
                  type="LineJsonParser", keys=["filename", "text"]
              ),
          )
          for data_info in dataset:
              file_path = data_info["img_path"]
              label = data_info["instances"][0]["text"]
              file_path = strip_cls(file_path)
              label = strip_cls(label)
              # MJ's file_path starts with './'
              if file_path.startswith("./"):
                  file_path = file_path[2:]
  
              file_paths.append(file_path)
              labels.append(label)
          return file_paths, labels
      else:
          with open(in_path) as f:
              if format == "txt":
                  for line in f:
                      line = strip_cls(line)
                      file_path, label = line.split()[:2]
                      # MJ's file_path starts with './'
                      if file_path.startswith("./"):
                          file_path = file_path[2:]
  
                      file_paths.append(file_path)
                      labels.append(label)
              elif format == "jsonl":
                  for line in f:
                      datum = json.loads(line)
                      file_path = datum["filename"]
                      # MJ's file_path starts with './'
                      if file_path.startswith("./"):
                          file_path = file_path[2:]
  
                      file_paths.append(file_path)
                      labels.append(datum["text"])
  
      return file_paths, labels
  
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 1 for calling a global function with example usage: parse_legacy_data(in_path, format) and returns: file_paths,  labels, file_paths,  labels