code: def _interval_invert(bounds, lb=None, ub=None):
      """invert the given intervals
  
      bounds is a list of tuples [(lo,hi),...],
      where lb and ub, if not given, are the extrema of bounds
      """
      if not len(bounds):
          return bounds
      import numpy
  
      bounds = numpy.asarray(bounds)
      _a, a_ = bounds.min(), bounds.max()
      lb = _a if lb is None else lb
      ub = a_ if ub is None else ub
      return [
          tuple(i)
          for i in numpy.array([lb] + bounds.ravel().tolist() + [ub])[
              2 * (lb == _a) : -2 * (ub == a_) or None
          ].reshape(-1, 2)
      ]
  
imports: from functools import reduce
  from collections.abc import Callable
  from mystic._counter import Counter
  from itertools import permutations
  from dill.source import getblocks
  from dill.source import getsource
  from mystic.monitors import Monitor
  from mystic.monitors import VerboseMonitor
  from mystic.monitors import LoggingMonitor
  from mystic.monitors import CustomMonitor
  from mystic.monitors import Null
label_desc: Use image node_id 48 for calling a global function with example usage: _interval_invert(bounds, lb, ub) and returns: unknown, bounds