code: def fill_placeholder(config: dict, config_extend: dict):
      """
      Detect placeholder in config and fill them with config_extend.
      The item of dict must be single item(int, str, etc), dict and list. Tuples are not supported.
      There are two type of variables:
      - user-defined variables :
          e.g. when config_extend is `{"<MODEL>": model, "<DATASET>": dataset}`, "<MODEL>" and "<DATASET>" in `config` will be replaced with `model` `dataset`
      - variables extracted from `config` :
          e.g. the variables like "<dataset.kwargs.segments.train.0>" will be replaced with the values from `config`
  
      Parameters
      ----------
      config : dict
          the parameter dict will be filled
      config_extend : dict
          the value of all placeholders
  
      Returns
      -------
      dict
          the parameter dict
      """
      # check the format of config_extend
      for placeholder in config_extend.keys():
          assert re.match(r"<[^<>]+>", placeholder)
  
      # bfs
      top = 0
      tail = 1
      item_queue = [config]
  
      def try_replace_placeholder(value):
          if value in config_extend.keys():
              value = config_extend[value]
          else:
              m = re.match(r"<(?P<name_path>[^<>]+)>", value)
              if m is not None:
                  try:
                      value = get_item_from_obj(
                          config, m.groupdict()["name_path"]
                      )
                  except (KeyError, ValueError, IndexError):
                      get_module_logger("fill_placeholder").info(
                          f"{value} lookes like a placeholder, but it can't match to any given values"
                      )
          return value
  
      while top < tail:
          now_item = item_queue[top]
          top += 1
          if isinstance(now_item, list):
              item_keys = range(len(now_item))
          elif isinstance(now_item, dict):
              item_keys = now_item.keys()
          for key in item_keys:  # noqa
              if isinstance(now_item[key], (list, dict)):
                  item_queue.append(now_item[key])
                  tail += 1
              elif isinstance(now_item[key], str):
                  # If it is a string, try to replace it with placeholder
                  now_item[key] = try_replace_placeholder(now_item[key])
      return config
  
imports: from __future__ import division
  from __future__ import print_function
  import os
  import re
  import copy
  import json
  import yaml
  import redis
  import bisect
  import struct
  import difflib
  import inspect
  import hashlib
  import datetime
  import requests
  import collections
  import numpy
  import pandas
  from pathlib import Path
  from typing import List, Union, Optional, Callable
  from packaging import version
  from .file import get_or_create_path, save_multiple_parts_file, unpack_archive_with_buffer, get_tmp_file_with_buffer
  from ..config import C
  from ..log import get_module_logger, set_log_with_config
  from .mod import get_module_by_module_path, split_module_path, get_callable_kwargs, get_cls_kwargs, init_instance_by_config, class_casting
label_desc: Use image node_id 34 for calling a global function with example usage: fill_placeholder(config, config_extend) and returns: config, value