code: def bin_perm_rep(ndim, a=0, b=1):
      """Ndim permutations with repetitions of (a,b).
  
      Returns an array with all the possible permutations with repetitions of
      (0,1) in ndim dimensions.  The array is shaped as (2**ndim,ndim), and is
      ordered with the last index changing fastest.  For examble, for ndim=3:
  
      Examples
      --------
      >>> bin_perm_rep(3)
      array([[0, 0, 0],
             [0, 0, 1],
             [0, 1, 0],
             [0, 1, 1],
             [1, 0, 0],
             [1, 0, 1],
             [1, 1, 0],
             [1, 1, 1]])
      """
      # Create the leftmost column as 0,0,...,1,1,...
      nperms = 2**ndim
      perms = np.empty((nperms, ndim), type(a))
      perms.fill(a)
      half_point = nperms // 2
      perms[half_point:, 0] = b
      # Fill the rest of the table by sampling the previous column every 2 items
      for j in range(1, ndim):
          half_col = perms[::2, j - 1]
          perms[:half_point, j] = half_col
          perms[half_point:, j] = half_col
      # This is equivalent to something like:
      # orders = [np.fromiter(np.binary_repr(s + 1, ndim), dtype=int)
      #           for s in np.arange(2 ** ndim)]
      return perms
  
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 22 for calling a global function with example usage: bin_perm_rep(ndim, a, b) and returns: perms