code: def extract(line, extract_expr):
      """
      return the extracted information list, such as losses.
      """
      log("Extract_expression is : ", extract_expr)
      x = re.findall("\{%(.)\}", extract_expr)
      assert len(x) == 1, "Must exist a {%d} | {%f} | {%s} "
      t = x[0]
      type_converter = {
          "f": float,
          "i": int,
          "s": str,
      }
      type_extracter = {
          "f": r"(-?\\d+\\.\\d+)",
          "i": r"(-?\\d+)",
          "s": r"(.*?)",
      }
      log(type_extracter[t])
      pattern = re.sub("\{%(.)\}", type_extracter[t], extract_expr, 1)
      log("Created Pattern is: ", pattern)
      x = re.findall(pattern, line)
      if len(x) == 0:
          return None
      assert (
          len(x) == 1
      ), f"Multiply matches are found for `{extract_expr}` in line: \n{line}"
      log("Find in line: ", x[0].strip())
      return type_converter[t](x[0].strip())
  
file_path: PaddleSeg/test_tipc/extract_loss.py
imports: import sys
  import argparse
  import re
label_desc: Use image node_id 4 for calling a global function with example usage: extract(line, extract_expr) and returns: type_converter, None