code: def prepare_input(x, y, axis, dydx=None):
      """Prepare input for cubic spline interpolators.
  
      All data are converted to numpy arrays and checked for correctness.
      Axes equal to `axis` of arrays `y` and `dydx` are moved to be the 0th
      axis. The value of `axis` is converted to lie in
      [0, number of dimensions of `y`).
      """
  
      x, y = map(np.asarray, (x, y))
      if np.issubdtype(x.dtype, np.complexfloating):
          raise ValueError("`x` must contain real values.")
      x = x.astype(float)
  
      if np.issubdtype(y.dtype, np.complexfloating):
          dtype = complex
      else:
          dtype = float
  
      if dydx is not None:
          dydx = np.asarray(dydx)
          if y.shape != dydx.shape:
              raise ValueError(
                  "The shapes of `y` and `dydx` must be identical."
              )
          if np.issubdtype(dydx.dtype, np.complexfloating):
              dtype = complex
          dydx = dydx.astype(dtype, copy=False)
  
      y = y.astype(dtype, copy=False)
      axis = axis % y.ndim
      if x.ndim != 1:
          raise ValueError("`x` must be 1-dimensional.")
      if x.shape[0] < 2:
          raise ValueError("`x` must contain at least 2 elements.")
      if x.shape[0] != y.shape[axis]:
          raise ValueError(
              f"The length of `y` along `axis`={axis} doesn't "
              "match the length of `x`"
          )
  
      if not np.all(np.isfinite(x)):
          raise ValueError("`x` must contain only finite values.")
      if not np.all(np.isfinite(y)):
          raise ValueError("`y` must contain only finite values.")
  
      if dydx is not None and not np.all(np.isfinite(dydx)):
          raise ValueError("`dydx` must contain only finite values.")
  
      dx = np.diff(x)
      if np.any(dx <= 0):
          raise ValueError("`x` must be strictly increasing sequence.")
  
      y = np.moveaxis(y, axis, 0)
      if dydx is not None:
          dydx = np.moveaxis(dydx, axis, 0)
  
      return x, dx, y, axis, dydx
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  import warnings
  import numpy
  from scipy.linalg import solve, solve_banded
  from .None import PPoly
  from ._polyint import _isscalar
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_input(x, y, axis, dydx) and returns: x,  dx,  y,  axis,  dydx