code: def check_ts_data_with_ts_target(X, y=None):
      """
      Checks time series data with time series target is good. If not raises value error.
  
      Parameters
      ----------
      X : array-like, shape [n_series, ...]
         Time series data and (optionally) contextual data
      y : array-like, shape [n_series, ...]
          target data
      """
      if y is not None:
          Nx = len(X)
          Ny = len(y)
  
          if Nx != Ny:
              raise ValueError(
                  "Number of time series different in X (%d) and y (%d)"
                  % (Nx, Ny)
              )
  
          Xt, _ = get_ts_data_parts(X)
          Ntx = np.array([len(Xt[i]) for i in np.arange(Nx)])
          Nty = np.array(
              [len(np.atleast_1d(y[i])) for i in np.arange(Nx)]
          )
  
          if np.count_nonzero(Nty == Ntx) == Nx:
              return
          else:
              raise ValueError(
                  "Invalid time series lengths.\n" "Ns: ",
                  Nx,
                  "Ntx: ",
                  Ntx,
                  "Nty: ",
                  Nty,
              )
  
file_path: seglearn/seglearn/util.py
imports: from pandas import DataFrame
  import numpy
  import warnings
  from seglearn.base import TS_Data
label_desc: Use image node_id 3 for calling a global function with example usage: check_ts_data_with_ts_target(X, y) without return types