code: def _get_clusters_st_multistep(keepers, neighbors, max_step=1):
      """Directly calculate clusters.
  
      This uses knowledge that time points are
      only adjacent to immediate neighbors for data organized as time x space.
  
      This algorithm time increases linearly with the number of time points,
      compared to with the square for the standard (graph) algorithm.
      """
      n_src = len(neighbors)
      n_times = len(keepers)
      t_border = list()
      t_border.append(0)
      for ki, k in enumerate(keepers):
          keepers[ki] = k + ki * n_src
          t_border.append(t_border[ki] + len(k))
      t_border = np.array(t_border)
      keepers = np.concatenate(keepers)
      v = keepers
      t, s = divmod(v, n_src)
  
      r = np.ones(t.shape, dtype=bool)
      clusters = list()
      inds = np.arange(t_border[0], t_border[n_times])
      next_ind = 0 if s.size > 0 else -1
      while next_ind >= 0:
          # put first point in a cluster, adjust remaining
          t_inds = [next_ind]
          r[next_ind] = False
          icount = 1  # count of nodes in the current cluster
          # look for significant values at the next time point,
          # same sensor, not placed yet, and add those
          while icount <= len(t_inds):
              ind = t_inds[icount - 1]
              selves = _get_selves(
                  r, s, ind, inds, t, t_border, max_step
              )
  
              # look at current time point across other vertices
              these_inds = inds[t_border[t[ind]] : t_border[t[ind] + 1]]
              buddies = _get_buddies(
                  r, s, neighbors[s[ind]], these_inds
              )
  
              t_inds += buddies + selves
              icount += 1
          next_ind = _where_first(r)
          clusters.append(v[t_inds])
  
      return clusters
  
imports: import numpy
  from scipy import ndimage, sparse
  from scipy.sparse.csgraph import connected_components
  from scipy.stats import f
  from scipy.stats import t
  from ..fixes import has_numba, jit
  from ..parallel import parallel_func
  from ..source_estimate import MixedSourceEstimate, SourceEstimate, VolSourceEstimate
  from ..source_space import SourceSpaces
  from ..utils import ProgressBar, _check_option, _pl, _validate_type, check_random_state, logger, split_list, verbose, warn
  from .parametric import f_oneway, ttest_1samp_no_p
label_desc: Use image node_id 10 for calling a global function with example usage: _get_clusters_st_multistep(keepers, neighbors, max_step) and returns: clusters