code: def _build_tqdm_iterator(iterable, verbose, **kwargs):
      """
      Build an iterable, possibly using tqdm (either in notebook or regular mode)
  
      Parameters
      ----------
      iterable
      verbose
      total
          Length of the iterator, helps in cases where tqdm is not detecting the total length.
  
      Returns
      -------
      """
  
      def _isnotebook():
          if get_ipython is None:
              return False
          try:
              shell = get_ipython().__class__.__name__
              if shell == "ZMQInteractiveShell":
                  return True  # Jupyter notebook or qtconsole
              elif shell == "TerminalInteractiveShell":
                  return False  # Terminal running IPython
              else:
                  return False  # Other type (?)
          except NameError:
              return False  # Probably standard Python interpreter
  
      if verbose:
          if _isnotebook():
              iterator = tqdm_notebook(iterable, **kwargs)
          else:
              iterator = tqdm(iterable, **kwargs)
  
      else:
          iterator = iterable
      return iterator
  
imports: from enum import Enum
  from functools import wraps
  from inspect import Parameter, getcallargs, signature
  from typing import Callable, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union
  import pandas
  from joblib import Parallel, delayed
  from tqdm import tqdm
  from tqdm.notebook import tqdm
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 2 for calling a global function with example usage: _build_tqdm_iterator(iterable, verbose) and returns: iterator, False, True, False, False, False