docs: def _check_args(f, G, y0, tspan, dW=None, IJ=None):
      """Do some validation common to all algorithms. Find dimension d and number
      of Wiener processes m.
      """
      if not np.isclose(min(np.diff(tspan)), max(np.diff(tspan))):
          raise SDEValueError('Currently time steps must be equally spaced.')
      # Be flexible to allow scalar equations. convert them to a 1D vector system
      if isinstance(y0, numbers.Number):
          if isinstance(y0, numbers.Integral):
              numtype = np.float64
          else:
              numtype = type(y0)
          y0_orig = y0
          y0 = np.array([y0], dtype=numtype)
          def make_vector_fn(fn):
              def newfn(y, t):
                  return np.array([fn(y[0], t)], dtype=numtype)
              newfn.__name__ = fn.__name__
              return newfn
          def make_matrix_fn(fn):
              def newfn(y, t):
                  return np.array([[fn(y[0], t)]], dtype=numtype)
              newfn.__name__ = fn.__name__
              return newfn
          if isinstance(f(y0_orig, tspan[0]), numbers.Number):
              f = make_vector_fn(f)
          if isinstance(G(y0_orig, tspan[0]), numbers.Number):
              G = make_matrix_fn(G)
      # determine dimension d of the system
      d = len(y0)
      if len(f(y0, tspan[0])) != d:
          raise SDEValueError('y0 and f have incompatible shapes.')
      message = """y0 has length %d. So G must either be a single function
                returning a matrix of shape (%d, m), or else a list of m separate
                functions each returning a column of G, with shape (%d,)""" % (
                    d, d, d)
      if callable(G):
          # then G must be a function returning a d x m matrix
          Gtest = G(y0, tspan[0])
          if Gtest.ndim != 2 or Gtest.shape[0] != d:
              raise SDEValueError(message)
          # determine number of independent Wiener processes m
          m = Gtest.shape[1]
      else:
          # G should be a list of m functions g_i giving columns of G
          G = tuple(G)
          m = len(G)
          Gtest = np.zeros((d, m))
          for k in range(0, m):
              if not callable(G[k]):
                  raise SDEValueError(message)
              Gtestk = G[k](y0, tspan[0])
              if np.shape(Gtestk) != (d,):
                  raise SDEValueError(message)
              Gtest[:,k] = Gtestk
      message = """From function G, it seems m==%d. If present, the optional
                parameter dW must be an array of shape (len(tspan)-1, m) giving
                m independent Wiener increments for each time interval.""" % m
      if dW is not None:
          if not hasattr(dW, 'shape') or dW.shape != (len(tspan) - 1, m):
              raise SDEValueError(message)
      message = """From function G, it seems m==%d. If present, the optional
                parameter I or J must be an array of shape (len(tspan)-1, m, m)
                giving an m x m matrix of repeated integral values for each
                time interval.""" % m
      if IJ is not None:
          if not hasattr(IJ, 'shape') or IJ.shape != (len(tspan) - 1, m, m):
              raise SDEValueError(message)
      return (d, m, f, G, y0, tspan, dW, IJ)