code: def _get_n_from_n_timepoints(n_timepoints, n="sqrt"):
      """Get number of intervals from number of time points.
  
      Helpful to compute number of intervals relative to time series length,
      e.g. using floats or functions.
  
      Parameters
      ----------
      n_timepoints : int
      n : {int, float, str, callable}
  
      Returns
      -------
      n_intervals_ : int
          Computed number of intervals
      """
      # check input: n_timepoints
      if not np.issubdtype(type(n_timepoints), np.dtype(int).type):
          raise ValueError(
              f"`n_timepoints` must be an integer, but found: "
              f"{type(n_timepoints)}"
          )
      if not n_timepoints >= 1:
          raise ValueError(
              f"`n_timepoints` must be >= 1, but found: {n_timepoints}"
          )
  
      # compute number of splits
      allowed_strings = ["sqrt", "log"]
  
      # integer
      if np.issubdtype(type(n), np.dtype(int).type):
          if not n <= n_timepoints:
              raise ValueError(
                  f"If `n_intervals` is an integer, it must be smaller "
                  f"than `n_timepoints`, but found:  `n_intervals`={n} "
                  f"and `n_timepoints`={n_timepoints}"
              )
          if n < 1:
              raise ValueError(
                  f"If `n_intervals` is an integer, "
                  f"`n_intervals` must be >= 1, but found: {n}"
              )
          n_intervals_ = n
  
      # function
      elif callable(n):
          n_intervals_ = n(n_timepoints)
  
      # string
      elif isinstance(n, str):
          if n not in allowed_strings:
              raise ValueError(
                  f"If `n_intervals` is a string, `n_intervals` must be "
                  f"in {allowed_strings}, but found: {n}"
              )
          str_func_map = {"sqrt": np.sqrt, "log": np.log}
          func = str_func_map[n]
          n_intervals_ = func(n_timepoints)
  
      # float
      elif isinstance(n, float):
          if not (0 < n <= 1):
              raise ValueError(
                  f"If `n_intervals` is a float, `n_intervals` must be > 0 "
                  f"and <= 1, but found: {n}"
              )
          n_intervals_ = n * n_timepoints
  
      else:
          raise ValueError(
              f"`n_intervals` must be either one of the allowed string options "
              f"in "
              f"{allowed_strings}, an integer or a float number."
          )
  
      # make sure n_intervals is an integer and there is at least one interval
      n_intervals_ = np.maximum(1, int(n_intervals_))
      return n_intervals_
  
imports: import math
  import numpy
  import pandas
  from sklearn.utils import check_random_state
  from sktime.datatypes._utilities import get_time_index
  from sktime.transformations._delegate import _DelegatedTransformer
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import check_window_length
label_desc: Use image node_id 3 for calling a global function with example usage: _get_n_from_n_timepoints(n_timepoints, n) and returns: n_intervals_