code: def subset(data, sel0, sel1):
      
  
      # check inputs
      data = np.asarray(data)
      if data.ndim < 2:
          raise ValueError('data must have 2 or more dimensions')
      sel0 = asarray_ndim(sel0, 1, allow_none=True)
      sel1 = asarray_ndim(sel1, 1, allow_none=True)
  
      # ensure indices
      if sel0 is not None and sel0.dtype.kind == 'b':
          sel0, = np.nonzero(sel0)
      if sel1 is not None and sel1.dtype.kind == 'b':
          sel1, = np.nonzero(sel1)
  
      # ensure leading dimension indices can be broadcast correctly
      if sel0 is not None and sel1 is not None:
          sel0 = sel0[:, np.newaxis]
  
      # deal with None arguments
      if sel0 is None:
          sel0 = _total_slice
      if sel1 is None:
          sel1 = _total_slice
  
      return data[sel0, sel1]
docs: Apply selections on first and second axes.