code: def _to_ndarray(self, a):
          
  
          if isinstance(a, (list, tuple)):
              a = numpy.array(a)
  
          if not is_ndarray(a):
              raise TypeError("Expected an ndarray but got object of type '{}' instead".format(type(a)))
  
          return a
docs: Casts Python lists and tuples to a numpy array or raises an AssertionError.