code: def parse_weights(text: str) -> List[List[Any]]:
      res: List[List[Any]] = []
      round_brackets = []
      square_brackets = []
  
      round_bracket_multiplier = 1.1
      square_bracket_multiplier = 1 / 1.1
  
      def multiply_range(
          start_position: int, multiplier: float
      ) -> None:
          for p in range(start_position, len(res)):
              res[p][1] *= multiplier
  
      for m in weight_pattern.finditer(text):
          text = m.group(0)
          weight = m.group(1)
  
          if text.startswith("\\"):
              res.append([text[1:], 1.0])
          elif text == "(":
              round_brackets.append(len(res))
          elif text == "[":
              square_brackets.append(len(res))
          elif weight is not None and len(round_brackets) > 0:
              multiply_range(round_brackets.pop(), float(weight))
          elif text == ")" and len(round_brackets) > 0:
              multiply_range(
                  round_brackets.pop(), round_bracket_multiplier
              )
          elif text == "]" and len(square_brackets) > 0:
              multiply_range(
                  square_brackets.pop(), square_bracket_multiplier
              )
          else:
              res.append([text, 1.0])
  
      for pos in round_brackets:
          multiply_range(pos, round_bracket_multiplier)
  
      for pos in square_brackets:
          multiply_range(pos, square_bracket_multiplier)
  
      if len(res) == 0:
          res = [["", 1.0]]
  
      i = 0
      while i + 1 < len(res):
          if res[i][1] != res[i + 1][1]:
              i += 1
          else:
              res[i][0] += res[i + 1][0]
              res.pop(i + 1)
  
      return res
  
imports: import re
  import dill
  import math
  import uuid
  import torch
  from torch import Tensor
  from typing import Any
  from typing import Dict
  from typing import List
  from typing import NamedTuple
  from .schema import IConditionModel
  from ....nlp.tokenizers import ITokenizer
  from ....nlp.tokenizers import ICLIPTokenizer
  from ....multimodal.clip import CLIP
  from .....misc.toolkit import get_device
label_desc: Use image node_id 1 for calling a global function with example usage: parse_weights(text) and returns: res