code: def ensure_object_is_ndarray(item, title):
      
      assert isinstance(title, str)
  
      if not isinstance(item, np.ndarray):
          msg = "{} must be a np.ndarray. {} passed instead."
          raise TypeError(msg.format(title, type(item)))
  
      return None
docs: Ensures that a given mapping matrix is a dense numpy array. Raises a
      helpful TypeError if otherwise.