code: def bootstrap(
      data,
      n_bootstraps,
      user_statistic,
      kwargs=None,
      pass_indices=False,
      random_state=None,
  ):
      """Compute bootstraped statistics of a dataset.
  
      Parameters
      ----------
      data : array_like
          An n-dimensional data array of size n_samples by n_attributes
      n_bootstraps : integer
          the number of bootstrap samples to compute.  Note that internally,
          two arrays of size (n_bootstraps, n_samples) will be allocated.
          For very large numbers of bootstraps, this can cause memory issues.
      user_statistic : function
          The statistic to be computed.  This should take an array of data
          of size (n_bootstraps, n_samples) and return the row-wise statistics
          of the data.
      kwargs : dictionary (optional)
          A dictionary of keyword arguments to be passed to the
          user_statistic function.
      pass_indices : boolean (optional)
          if True, then the indices of the points rather than the points
          themselves are passed to `user_statistic`
      random_state: RandomState or an int seed (0 by default)
          A random number generator instance
  
      Returns
      -------
      distribution : ndarray
          the bootstrapped distribution of statistics (length = n_bootstraps)
      """
      # we don't set kwargs={} by default in the argument list, because using
      # a mutable type as a default argument can lead to strange results
      if kwargs is None:
          kwargs = {}
  
      rng = check_random_state(random_state)
      data = np.asarray(data)
      if data.ndim != 1:
          n_samples = data.shape[0]
          warnings.warn(
              "bootstrap data are n-dimensional: "
              "assuming ordered n_samples by n_attributes"
          )
      else:
          n_samples = data.size
  
      # Generate random indices with repetition
      ind = rng.randint(n_samples, size=(n_bootstraps, n_samples))
      data = data[ind].reshape(-1, data[ind].shape[-1])
      # Call the function
      if pass_indices:
          stat_bootstrap = user_statistic(ind, **kwargs)
      else:
          stat_bootstrap = user_statistic(data, **kwargs)
  
      # compute the statistic on the data
      return stat_bootstrap
  
imports: import numpy
  import warnings
  from sklearn.utils import check_random_state
label_desc: Use image node_id 1 for calling a global function with example usage: bootstrap(data, n_bootstraps, user_statistic, kwargs, pass_indices, random_state) and returns: stat_bootstrap