code: def compress(condition, data, axis=0, out=None, blen=None, storage=None, create='array',
               **kwargs):
      
  
      # setup
      if out is not None:
          # argument is only there for numpy API compatibility
          raise NotImplementedError('out argument is not supported')
      storage = _util.get_storage(storage)
      blen = _util.get_blen_array(data, blen)
      length = len(data)
      nnz = count_nonzero(condition)
  
      if axis == 0:
          _util.check_equal_length(data, condition)
  
          # block iteration
          out = None
          for i in range(0, length, blen):
              j = min(i+blen, length)
              bcond = np.asarray(condition[i:j])
              # don't access any data unless we have to
              if np.any(bcond):
                  block = np.asarray(data[i:j])
                  res = np.compress(bcond, block, axis=0)
                  if out is None:
                      out = getattr(storage, create)(res, expectedlen=nnz, **kwargs)
                  else:
                      out.append(res)
          return out
  
      elif axis == 1:
  
          # block iteration
          out = None
          condition = np.asanyarray(condition)
          for i in range(0, length, blen):
              j = min(i+blen, length)
              block = np.asarray(data[i:j])
              res = np.compress(condition, block, axis=1)
              if out is None:
                  out = getattr(storage, create)(res, expectedlen=length,
                                                 **kwargs)
              else:
                  out.append(res)
  
          return out
  
      else:
          raise NotImplementedError('axis not supported: %s' % axis)
docs: Return selected slices of an array along given axis.