code: def select(collection, indices):
      """Selects the subset specified by indices from collection.
  
      >>> select([0, 1, 2, 3, 4], [1, 3])
      [1, 3]
  
      """
      try:
          return collection[indices, ...]
      except IndexError:  # caused by scipy.sparse in some versions
          return collection[indices, :]
      except (
          TypeError
      ):  # not dealing with numpy or comparable, probably a list
          if _spark_available and isinstance(
              collection, pyspark.rdd.RDD
          ):
              indexset = set(indices)
              return (
                  collection.zipWithIndex()
                  .filter(lambda x: x[1] in indexset)
                  .map(lambda x: x[0])
              )
          return [collection[i] for i in indices]
  
imports: import math
  import random
  import itertools
  import functools
  import operator
  import array
  import inspect
label_desc: Use image node_id 1 for calling a global function with example usage: select(collection, indices) and returns: collection, collection, unknown, collection