code: def select(condlist, choicelist, default=0):
      """Return an array drawn from elements in choicelist, depending on conditions.
  
      Args:
          condlist (list of bool arrays): The list of conditions which determine
              from which array in `choicelist` the output elements are taken.
              When multiple conditions are satisfied, the first one encountered
              in `condlist` is used.
          choicelist (list of cupy.ndarray): The list of arrays from which the
              output elements are taken. It has to be of the same length
              as `condlist`.
          default (scalar) : If provided, will fill element inserted in `output`
              when all conditions evaluate to False. default value is 0.
  
      Returns:
          cupy.ndarray: The output at position m is the m-th element of the
          array in `choicelist` where the m-th element of the corresponding
          array in `condlist` is True.
  
      .. seealso:: :func:`numpy.select`
      """  # NOQA
  
      if len(condlist) != len(choicelist):
          raise ValueError(
              "list of cases must be same length as list of conditions"
          )
  
      if len(condlist) == 0:
          raise ValueError(
              "select with an empty condition list is not possible"
          )
  
      if not cupy.isscalar(default):
          raise TypeError("default only accepts scalar values")
  
      for i in range(len(choicelist)):
          if not isinstance(choicelist[i], cupy.ndarray):
              raise TypeError(
                  "choicelist only accepts lists of cupy ndarrays"
              )
          cond = condlist[i]
          if cond.dtype.type is not cupy.bool_:
              raise ValueError(
                  "invalid entry {} in condlist: should be boolean ndarray".format(
                      i
                  )
              )
  
      dtype = cupy.result_type(*choicelist)
  
      condlist = cupy.broadcast_arrays(*condlist)
      choicelist = cupy.broadcast_arrays(*choicelist, default)
  
      if choicelist[0].ndim == 0:
          result_shape = condlist[0].shape
      else:
          result_shape = cupy.broadcast_arrays(
              condlist[0], choicelist[0]
          )[0].shape
  
      result = cupy.empty(result_shape, dtype)
      cupy.copyto(result, default)
  
      choicelist = choicelist[-2::-1]
      condlist = condlist[::-1]
      for choice, cond in zip(choicelist, condlist):
          cupy.copyto(result, choice, where=cond)
  
      return result
  
file_path: cupy/cupy/_indexing/indexing.py
imports: import cupy
  from cupy._core import internal
label_desc: Use image node_id 7 for calling a global function with example usage: select(condlist, choicelist, default) and returns: result