code: def _lazyselect(condlist, choicelist, arrays, default=0):
      """
      Mimic `np.select(condlist, choicelist)`.
  
      Notice, it assumes that all `arrays` are of the same shape or can be
      broadcasted together.
  
      All functions in `choicelist` must accept array arguments in the order
      given in `arrays` and must return an array of the same shape as broadcasted
      `arrays`.
  
      Examples
      --------
      >>> x = np.arange(6)
      >>> np.select([x <3, x > 3], [x**2, x**3], default=0)
      array([  0,   1,   4,   0,  64, 125])
  
      >>> _lazyselect([x < 3, x > 3], [lambda x: x**2, lambda x: x**3], (x,))
      array([   0.,    1.,    4.,   0.,   64.,  125.])
  
      >>> a = -np.ones_like(x)
      >>> _lazyselect([x < 3, x > 3],
      ...             [lambda x, a: x**2, lambda x, a: a * x**3],
      ...             (x, a), default=np.nan)
      array([   0.,    1.,    4.,   nan,  -64., -125.])
  
      """
      arrays = np.broadcast_arrays(*arrays)
      tcode = np.mintypecode([a.dtype.char for a in arrays])
      out = np.full(
          np.shape(arrays[0]), fill_value=default, dtype=tcode
      )
      for index in range(len(condlist)):
          func, cond = choicelist[index], condlist[index]
          if np.all(cond is False):
              continue
          cond, _ = np.broadcast_arrays(cond, arrays[0])
          temp = tuple(np.extract(cond, arr) for arr in arrays)
          np.place(out, cond, func(*temp))
      return out
  
imports: from contextlib import contextmanager
  import functools
  import operator
  import sys
  import warnings
  import numbers
  from collections import namedtuple
  import inspect
  import math
  from typing import Optional, Union, TYPE_CHECKING, TypeVar
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _lazyselect(condlist, choicelist, arrays, default) and returns: out