code: def first_n_items(array, n_desired):
      
      # Unfortunately, we can't just do array.flat[:n_desired] here because it
      # might not be a numpy.ndarray. Moreover, access to elements of the array
      # could be very expensive (e.g. if it's only available over DAP), so go out
      # of our way to get them in a single call to __getitem__ using only slices.
      if n_desired < 1:
          raise ValueError('must request at least one item')
  
      if array.size == 0:
          # work around for https://github.com/numpy/numpy/issues/5195
          return []
  
      if n_desired < array.size:
          indexer = _get_indexer_at_least_n_items(array.shape, n_desired,
                                                  from_end=False)
          array = array[indexer]
      return np.asarray(array).flat[:n_desired]
docs: Returns the first n_desired items of an array