code: def _flatten(args, inout_str):
      if isinstance(args, symbol.Symbol):
          length = len(args.list_outputs())
          length = length if length > 1 else 0
          return [args], int(length)
  
      assert isinstance(args, (list, tuple)), (
          f"{inout_str} must be (nested) list of Symbol, "
          f"but got {str(args)} of type {str(type(args))}"
      )
      flat = []
      fmts = []
      for i in args:
          arg, fmt = _flatten(i, inout_str)
          flat.extend(arg)
          fmts.append(fmt)
      return flat, fmts
  
imports: import math
  import ctypes
  import copy
  from .random import uniform
  from .symbol import Symbol
  from .None import symbol
  from ..base import _LIB, check_call
  from ..base import SymbolHandle, _as_list
  from ..attribute import AttrScope, current
label_desc: Use image node_id 2 for calling a global function with example usage: _flatten(args, inout_str) and returns: flat,  fmts, list,  int