code: def tf_mixed_norm_solver(
      M,
      G,
      alpha_space,
      alpha_time,
      wsize=64,
      tstep=4,
      n_orient=1,
      maxit=200,
      tol=1e-8,
      active_set_size=None,
      debias=True,
      return_gap=False,
      dgap_freq=10,
      verbose=None,
  ):
      """Solve TF L21+L1 inverse solver with BCD and active set approach.
  
      See :footcite:`GramfortEtAl2013b,GramfortEtAl2011,BekhtiEtAl2016`.
  
      Parameters
      ----------
      M : array, shape (n_sensors, n_times)
          The data.
      G : array, shape (n_sensors, n_dipoles)
          The gain matrix a.k.a. lead field.
      alpha_space : float
          The spatial regularization parameter.
      alpha_time : float
          The temporal regularization parameter. The higher it is the smoother
          will be the estimated time series.
      wsize: int or array-like
          Length of the STFT window in samples (must be a multiple of 4).
          If an array is passed, multiple TF dictionaries are used (each having
          its own wsize and tstep) and each entry of wsize must be a multiple
          of 4.
      tstep: int or array-like
          Step between successive windows in samples (must be a multiple of 2,
          a divider of wsize and smaller than wsize/2) (default: wsize/2).
          If an array is passed, multiple TF dictionaries are used (each having
          its own wsize and tstep), and each entry of tstep must be a multiple
          of 2 and divide the corresponding entry of wsize.
      n_orient : int
          The number of orientation (1 : fixed or 3 : free or loose).
      maxit : int
          The number of iterations.
      tol : float
          If absolute difference between estimates at 2 successive iterations
          is lower than tol, the convergence is reached.
      debias : bool
          Debias source estimates.
      return_gap : bool
          Return final duality gap.
      dgap_freq : int or np.inf
          The duality gap is evaluated every dgap_freq iterations.
      %(verbose)s
  
      Returns
      -------
      X : array, shape (n_active, n_times)
          The source estimates.
      active_set : array
          The mask of active sources.
      E : list
          The value of the objective function every dgap_freq iteration. If
          log_objective is False or dgap_freq is np.inf, it will be empty.
      gap : float
          Final duality gap. Returned only if return_gap is True.
  
      References
      ----------
      .. footbibliography::
      """
      n_sensors, n_times = M.shape
      n_sensors, n_sources = G.shape
      n_positions = n_sources // n_orient
  
      tstep = np.atleast_1d(tstep)
      wsize = np.atleast_1d(wsize)
      if len(tstep) != len(wsize):
          raise ValueError(
              "The same number of window sizes and steps must be "
              "passed. Got tstep = %s and wsize = %s" % (tstep, wsize)
          )
  
      n_steps = np.ceil(M.shape[1] / tstep.astype(float)).astype(int)
      n_freqs = wsize // 2 + 1
      n_coefs = n_steps * n_freqs
      phi = _Phi(wsize, tstep, n_coefs, n_times)
      phiT = _PhiT(tstep, n_freqs, n_steps, n_times)
  
      if n_orient == 1:
          lc = np.sum(G * G, axis=0)
      else:
          lc = np.empty(n_positions)
          for j in range(n_positions):
              G_tmp = G[:, (j * n_orient) : ((j + 1) * n_orient)]
              lc[j] = np.linalg.norm(np.dot(G_tmp.T, G_tmp), ord=2)
  
      logger.info(
          "Using block coordinate descent with active set approach"
      )
      X, Z, active_set, E, gap = _tf_mixed_norm_solver_bcd_active_set(
          M,
          G,
          alpha_space,
          alpha_time,
          lc,
          phi,
          phiT,
          Z_init=None,
          n_orient=n_orient,
          maxit=maxit,
          tol=tol,
          dgap_freq=dgap_freq,
          verbose=None,
      )
  
      if np.any(active_set) and debias:
          bias = compute_bias(M, G[:, active_set], X, n_orient=n_orient)
          X *= bias[:, np.newaxis]
  
      if return_gap:
          return X, active_set, E, gap
      else:
          return X, active_set, E
  
imports: import functools
  from math import sqrt
  import numpy
  from ..time_frequency._stft import istft, stft, stft_norm1, stft_norm2
  from ..utils import _check_option, _get_blas_funcs, _validate_type, logger, sum_squared, verbose, warn
  from .mxne_debiasing import compute_bias
label_desc: Use image node_id 22 for calling a global function with example usage: tf_mixed_norm_solver(M, G, alpha_space, alpha_time, wsize, tstep, n_orient, maxit, tol, active_set_size, debias, return_gap, dgap_freq, verbose) and returns: X,  active_set,  E,  gap, X,  active_set,  E