code: def val2tuple(
      x: Union[list[Any], tuple[Any, ...], Any],
      min_len: int = 1,
      idx_repeat: int = -1,
  ) -> tuple[Any, ...]:
      x = val2list(x)
  
      # repeat elements if necessary
      if len(x) > 0:
          x[idx_repeat:idx_repeat] = [
              x[idx_repeat] for _ in range(min_len - len(x))
          ]
  
      return tuple(x)
  
label_desc: Use image node_id 2 for calling a global function with example usage: val2tuple(x, min_len, idx_repeat) and returns: tuple