code: def to_numba_timeseries(x: np.ndarray) -> np.ndarray:
      """Convert a time series to a valid time series for numba use.
  
      Parameters
      ----------
      x: np.ndarray (1d or 2d)
          A time series.
  
      Returns
      -------
      np.ndarray (2d array)
          2d array that is the formatted time series.
  
      Raises
      ------
      ValueError
          If the value provided is not a numpy array
          If the matrix provided is greater than 2 dimensions
      """
      if not isinstance(x, np.ndarray):
          raise ValueError(
              f"The value {x} is an invalid time series. To perform a"
              f"distance computation a numpy array must be provided."
          )
  
      _x = np.array(x, copy=True, dtype=float)
      num_dims = _x.ndim
      shape = _x.shape
      if num_dims == 1 or (
          num_dims == 2 and _x.shape[1] == 1 and _x.shape[0] != 1
      ):
          _x = np.reshape(_x, (1, shape[0]))
      elif num_dims > 2:
          raise ValueError(
              "The matrix provided has more than 2 dimensions. This is not"
              "supported. Please provide a matrix with less than "
              "2 dimensions"
          )
      return _x
  
file_path: sktime/sktime/distances/_numba_utils.py
imports: from typing import Callable
  import numpy
  from sktime.distances.base import DistanceCallable
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 4 for calling a global function with example usage: to_numba_timeseries(x) and returns: _x