code: def permute(
      outcome_name: str, outcome: np.ndarray, permute_fraction: float
  ):
      """
      If the permute_fraction is 1, we permute all the values in the outcome.
      Otherwise we make use of the Fisher Yates shuffle.
      Refer to https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle for more details.
  
      :param 'outcome': np.ndarray
          The outcome variable to be permuted.
      :param 'permute_fraction': float [0, 1]
          The fraction of rows permuted.
      """
      if permute_fraction == 1:
          outcome = pd.DataFrame(outcome)
          outcome.columns = [outcome_name]
          return outcome[outcome_name].sample(frac=1).values
      elif permute_fraction < 1:
          permute_fraction /= (
              2  # We do this as every swap leads to two changes
          )
          changes = np.where(
              np.random.uniform(0, 1, outcome.shape[0])
              <= permute_fraction
          )[
              0
          ]  # As this is tuple containing a single element (array[...])
          num_rows = outcome.shape[0]
          for change in changes:
              if change + 1 < num_rows:
                  index = np.random.randint(change + 1, num_rows)
                  temp = outcome[change]
                  outcome[change] = outcome[index]
                  outcome[index] = temp
          return outcome
      else:
          raise ValueError(
              "The value of permute_fraction is {}. Which is greater than 1.".format(
                  permute_fraction
              )
          )
  
imports: import copy
  import logging
  from collections import OrderedDict, namedtuple
  from typing import Callable, List, Optional, Union
  import numpy
  import pandas
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.linear_model import LinearRegression
  from sklearn.neighbors import KNeighborsRegressor
  from sklearn.neural_network import MLPRegressor
  from sklearn.svm import SVR
  from tqdm.auto import tqdm
  from dowhy.causal_estimator import CausalEstimate
  from dowhy.causal_estimators.econml import Econml
  from dowhy.causal_identifier.identified_estimand import IdentifiedEstimand
  from dowhy.causal_refuter import CausalRefutation, CausalRefuter, choose_variables, test_significance
label_desc: Use image node_id 7 for calling a global function with example usage: permute(outcome_name, outcome, permute_fraction) and returns: outcome, outcome