code: def layout_model_config_parser(
      config, backend_name=None, model_arch=None
  ) -> LayoutModelConfig:
      assert (
          config.split("/")[-1] in ALLOWED_LAYOUT_MODEL_IDENTIFIER_NAMES
      ), (
          f"The input config {config} does not contain identifier information."
          f"Consider run `config = add_identifier_for_config(config, identifier)` first."
      )
  
      parts = config[len(LAYOUT_PARSER_MODEL_PREFIX) :].split("/")
      if len(parts) == 4:  # Full format
          backend_name, dataset_name, model_arch, identifier = parts
      elif len(parts) == 3:  # Short format
          assert backend_name != None
  
          if parts[0] == backend_name:
              # lp://<backend-name>/<dataset-name>/<identifier>
              assert model_arch != None
              _, dataset_name, identifier = parts
          else:
              # lp://<dataset-name>/<model-arch>/<identifier>
              dataset_name, model_arch, identifier = parts
  
      elif len(parts) == 2:  # brief format
          assert backend_name != None
          assert model_arch != None
          if parts[0] == backend_name:
              # lp://<backend-name>/<identifier>
              raise ValueError(f"Invalid LP Model Config {config}")
  
          # lp://<dataset-name>/<identifier>
          dataset_name, identifier = parts
      else:
          raise ValueError(f"Invalid LP Model Config {config}")
  
      return LayoutModelConfig(
          backend_name=backend_name,
          dataset_name=dataset_name,
          model_arch=model_arch,
          identifier=identifier,
      )
  
file_path: layout-parser/src/layoutparser/models/model_config.py
imports: from dataclasses import dataclass
label_desc: Use image node_id 3 for calling a global function with example usage: layout_model_config_parser(config, backend_name, model_arch) and returns: LayoutModelConfig