code: def _to_tuple(x):
      """Converts lists to tuples, including nested lists.
  
      All other non-list inputs are passed through unmodified. This function is
      intended to be used to convert potentially nested lists from json files
      into valid nodes.
  
      Examples
      --------
      >>> _to_tuple([1, 2, [3, 4]])
      (1, 2, (3, 4))
      """
      if not isinstance(x, tuple | list):
          return x
      return tuple(map(_to_tuple, x))
  
imports: from itertools import chain, count
  import networkx
label_desc: Use image node_id 1 for calling a global function with example usage: _to_tuple(x) and returns: tuple, x