code: def _check_var(var, dtype, ndmin, name, shape=None, shape2=None):
      r
      if var is None:
          raise ValueError
      var = np.array(var, dtype=dtype, copy=True, ndmin=ndmin)
      if shape:
          _check_shape(var, name, shape, shape2)
      return var
docs: r"""Return variable as array of dtype, ndmin; shape-checked.