code: def check_npndarray(val, dtype=None, writeable=True, verbose=True):
      
  
      if not isinstance(val, np.ndarray):
          raise TypeError('Input is not a numpy array.')
  
      if ((not isinstance(dtype, type(None))) and
              (not np.issubdtype(val.dtype, dtype))):
          raise TypeError('The numpy array elements are not of type: {}'
                          ''.format(dtype))
  
      if not writeable and verbose and val.flags.writeable:
          warn('Making input data immutable.')
  
      val.flags.writeable = writeable
docs: Check if input object is a numpy array.
  
      Parameters
      ----------
      val : np.ndarray
          Input object