code: def force_lmdb(cfg):
      """Force the dataset to be dumped in lmdb format.
  
      Args:
          cfg (Config): Config object.
  
      Returns:
          Config: Config object.
      """
      for split in ["train", "val", "test"]:
          preparer_cfg = cfg.get(f"{split}_preparer")
          if preparer_cfg:
              if preparer_cfg.get("dumper") is None:
                  raise ValueError(
                      f"{split} split does not come with a dumper, "
                      "so most likely the annotations are MMOCR-ready and do "
                      "not need any adaptation, and it "
                      "cannot be dumped in LMDB format."
                  )
              preparer_cfg.dumper["type"] = "TextRecogLMDBDumper"
  
      cfg.config_generator["dataset_name"] = f"{cfg.dataset_name}_lmdb"
  
      for split in ["train_anns", "val_anns", "test_anns"]:
          if split in cfg.config_generator:
              # It can be None when users want to clear out the default
              # value
              if not cfg.config_generator[split]:
                  continue
              ann_list = cfg.config_generator[split]
              for ann_dict in ann_list:
                  ann_dict["ann_file"] = (
                      osp.splitext(ann_dict["ann_file"])[0] + ".lmdb"
                  )
          else:
              if split == "train_anns":
                  ann_list = [dict(ann_file="textrecog_train.lmdb")]
              elif split == "test_anns":
                  ann_list = [dict(ann_file="textrecog_test.lmdb")]
              else:
                  ann_list = []
          cfg.config_generator[split] = ann_list
  
      return cfg
  
file_path: mmocr/tools/dataset_converters/prepare_dataset.py
imports: import argparse
  import os.path
  import time
  import warnings
  from mmengine import Config
  from mmocr.datasets.preparers import DatasetPreparer
label_desc: Use image node_id 3 for calling a global function with example usage: force_lmdb(cfg) and returns: cfg