code: def mix(*args, is_monit: bool = True):
      """
      This has two overloads
  
      .. function:: mix(*iterators: Tuple[Union[str, Callable[[Any], None]], Union[Sized, int]], is_monit: bool = True)
          :noindex:
  
      .. function:: mix(total_iterations: int, *iterators: Tuple[Union[str, Callable[[Any], None]], Union[Sized, int]], is_monit: bool = True)
          :noindex:
  
      This will iterate through a list of iterators while mixing among them.
      This is useful, for instance, when you want to mix training, validation, sampling steps within an epoch.
  
      You can give it tuples of iterator names and iterators.
      It will yield the names along with the iterator values.
  
      If you pass a function instead of a name it will call that function with the iterator value, instead of
      yielding it.
  
      Arguments:
          total_iterations (Union[Collection, range, int]): The number of times to mix
          iterators (Tuple[Union[str, Callable[[Any], None]], Union[Sized, int]]): Are iterators and their names or callback function
          is_monit (bool, optional): Whether to monitor the iterations, when inside :func:`loop`. Default to ``True``.
      """
  
      total_iterations = None
      iterators = []
      for arg in args:
          if isinstance(arg, tuple):
              r, it = arg
              if isinstance(it, int):
                  it = range(it)
              iterators.append((r, it))
          elif isinstance(arg, int):
              total_iterations = arg
          else:
              raise ValueError(
                  f"Unknown argument type: {type(arg)}, {arg}"
              )
  
      if total_iterations is None:
          total_iterations = max(
              len(iterator[1]) for iterator in iterators
          )
  
      return _internal().mix(
          total_iterations, list(iterators), is_monit=is_monit
      )
  
imports: import functools
  from typing import Iterable, Sized, Collection, Callable, Tuple, Any, Dict
  from typing import Union, Optional, overload
  from labml.internal.monitor import TimeSummary
  from labml.internal.monitor import monitor_singleton
label_desc: Use image node_id 16 for calling a global function with example usage: mix() and returns: _internal