code: def _permute_two_sample_iscs(
      iscs,
      group_parameters,
      i,
      pairwise=False,
      summary_statistic="median",
      exact_permutations=None,
      prng=None,
  ):
      """Applies two-sample permutations to ISC data
  
      Input ISCs should be n_subjects (leave-one-out approach) or
      n_pairs (pairwise approach) by n_voxels or n_ROIs array.
      This function is only intended to be used internally by the
      permutation_isc function in this module.
  
      Parameters
      ----------
      iscs : ndarray or list
          ISC values
  
      group_parameters : dict
          Dictionary of group parameters
  
      i : int
          Permutation iteration
  
      pairwise : bool, default: False
          Indicator of pairwise or leave-one-out, should match ISCs variable
  
      summary_statistic : str, default: 'median'
          Summary statistic, either 'median' (default) or 'mean'
  
      exact_permutations : list
          List of permutations
  
      prng = None or np.random.RandomState, default: None
          Initial random seed
          Indicator of pairwise or leave-one-out, should match ISCs variable
  
      Returns
      -------
      isc_sample : ndarray
          Array of permuted ISC values
  
      """
  
      # Shuffle the group assignments
      if exact_permutations:
          group_shuffler = np.array(exact_permutations[i])
      elif not exact_permutations and pairwise:
          group_shuffler = prng.permutation(
              np.arange(
                  len(
                      np.array(group_parameters["group_assignment"])[
                          group_parameters["sorter"]
                      ]
                  )
              )
          )
      elif not exact_permutations and not pairwise:
          group_shuffler = prng.permutation(
              np.arange(len(group_parameters["group_assignment"]))
          )
  
      # If pairwise approach, convert group assignments to matrix
      if pairwise:
          # Apply shuffler to group matrix rows/columns
          group_shuffled = group_parameters["group_matrix"][
              group_shuffler, :
          ][:, group_shuffler]
  
          # Unsort shuffled matrix and squareform to create selector
          group_selector = squareform(
              group_shuffled[group_parameters["unsorter"], :][
                  :, group_parameters["unsorter"]
              ],
              checks=False,
          )
  
      # Shuffle group assignments in leave-one-out two sample test
      elif not pairwise:
          # Apply shuffler to group matrix rows/columns
          group_selector = np.array(
              group_parameters["group_assignment"]
          )[group_shuffler]
  
      # Get difference of within-group summary statistics
      # with group permutation
      isc_sample = compute_summary_statistic(
          iscs[
              group_selector == group_parameters["group_labels"][0], :
          ],
          summary_statistic=summary_statistic,
          axis=0,
      ) - compute_summary_statistic(
          iscs[
              group_selector == group_parameters["group_labels"][1], :
          ],
          summary_statistic=summary_statistic,
          axis=0,
      )
  
      return isc_sample
  
imports: import numpy
  import logging
  from scipy.spatial.distance import squareform
  from itertools import combinations, permutations, product
  from brainiak.fcma.util import compute_correlation
  from brainiak.utils.utils import array_correlation, phase_randomize, p_from_null, _check_timeseries_input
label_desc: Use image node_id 12 for calling a global function with example usage: _permute_two_sample_iscs(iscs, group_parameters, i, pairwise, summary_statistic, exact_permutations, prng) and returns: isc_sample