docs: def _makemasks(self, index=None, level=0):
          """
          Internal function for generating masks for selecting values based on multi-index values.
  
          As all other multi-index functions will call this function, basic type-checking is also
          performed at this stage.
          """
          if index is None:
              index = self.index
  
          try:
              dims = len(array(index).shape)
              if dims == 1:
                  index = array(index, ndmin=2).T
          except:
              raise TypeError('A multi-index must be convertible to a numpy ndarray')
  
          try:
              index = index[:, level]
          except:
              raise ValueError("Levels must be indices into individual elements of the index")
  
          lenIdx = index.shape[0]
          nlevels = index.shape[1]
  
          combs = product(*[unique(index.T[i, :]) for i in range(nlevels)])
          combs = array([l for l in combs])
  
          masks = array([[array_equal(index[i], c) for i in range(lenIdx)] for c in combs])
  
          return zip(*[(masks[x], combs[x]) for x in range(len(masks)) if masks[x].any()])