docs: def plot_connectivity_timespectrum(a, fs=2, crange=None, freq_range=(-np.inf, np.inf), time_range=None, diagonal=0, border=False, fig=None):
      """ Draw time/frequency connectivity plots.
  
      Parameters
      ----------
      a : array, shape (n_channels, n_channels, n_fft, n_timesteps)
          Values to draw
      fs : float
          Sampling frequency
      crange : [int, int], optional
          Range of values covered by the colormap.
          If set to None, [min(a), max(a)] is substituted.
      freq_range : (float, float)
          Frequency range to plot
      time_range : (float, float)
          Time range covered by `a`
      diagonal : {-1, 0, 1}
          If diagonal == -1 nothing is plotted on the diagonal (a[i,i,:] are not plotted),
          if diagonal == 0, a is plotted on the diagonal too (all a[i,i,:] are plotted),
          if diagonal == 1, a is plotted on the diagonal only (only a[i,i,:] are plotted)
      border : bool
          If border == true the leftmost column and the topmost row are left blank
      fig : Figure object, optional
          Figure to plot into. If set to `None`, a new figure is created.
  
      Returns
      -------
      fig : Figure object
          The figure into which was plotted.
      """
      a = np.asarray(a)
      [_, m, _, t] = a.shape
  
      if crange is None:
          crange = [np.min(a), np.max(a)]
  
      if time_range is None:
          t0 = 0
          t1 = t
      else:
          t0, t1 = time_range
  
      f0, f1 = fs / 2, 0
      extent = [t0, t1, f0, f1]
  
      ymin = max(freq_range[0], f1)
      ymax = min(freq_range[1], f0)
  
      if fig is None:
          fig = new_figure()
  
      axes = []
      for i in range(m):
          if diagonal == 1:
              jrange = [i]
          elif diagonal == 0:
              jrange = range(m)
          else:
              jrange = [j for j in range(m) if j != i]
          for j in jrange:
              if border:
                  ax = fig.add_subplot(m+1, m+1, j + (i+1) * (m+1) + 2)
              else:
                  ax = fig.add_subplot(m, m, j + i * m + 1)
              axes.append(ax)
              ax.imshow(a[i, j, :, :], vmin=crange[0], vmax=crange[1], aspect='auto', extent=extent)
              ax.invert_yaxis()
  
              ax.xaxis.set_major_locator(MaxNLocator(max(1, 9 - m)))
              ax.yaxis.set_major_locator(MaxNLocator(max(1, 7 - m)))
              ax.set_ylim(ymin, ymax)
  
              if 0 < i < m - 1:
                  ax.set_xticks([])
              if 0 < j < m - 1:
                  ax.set_yticks([])
  
              if i == 0:
                  ax.xaxis.tick_top()
              if i == m-1:
                  ax.xaxis.tick_bottom()
  
              if j == 0:
                  ax.yaxis.tick_left()
              if j == m-1:
                  ax.yaxis.tick_right()
  
      _plot_labels(fig,
                   {'x': 0.5, 'y': 0.025, 's': 'time (s)', 'horizontalalignment': 'center'},
                   {'x': 0.05, 'y': 0.5, 's': 'frequency (Hz)', 'horizontalalignment': 'center', 'rotation': 'vertical'})
  
      return fig