code: def generate_bootstrap_samples(
      *,
      n_samples: int,
      random_state: Optional[Union[int, np.random.RandomState]],
      data: pd.DataFrame,
      annotated_functions: Dict[str, AnnotatedMetricFunction],
      sensitive_feature_names: List[str],
      control_feature_names: Optional[List[str]],
  ) -> List[DisaggregatedResult]:
      """Create a list of bootstrapped DisaggregatedResults.
  
      The list will contain n_samples, and a random_state must be supplied.
  
      If random_state is an integer or a numpy generator, it will be used to
      create a list of num_samples random integers, which will then be used as
      the seeds for each bootstrap sample
      """
      assert n_samples >= 1
      if random_state is None:
          generator = np.random.default_rng()
          rs = generator.integers(
              low=0, high=np.iinfo(np.uint32).max, size=n_samples
          )
      elif isinstance(random_state, np.random.RandomState):
          rs = random_state.randint(
              low=0, high=np.iinfo(np.uint32).max, size=n_samples
          )
      elif isinstance(random_state, int):
          generator = np.random.default_rng(seed=random_state)
          rs = generator.integers(
              low=0, high=np.iinfo(np.uint32).max, size=n_samples
          )
      else:
          raise ValueError(f"Unsupported random_state: {random_state}")
  
      result = []
      for i in range(n_samples):
          nxt = generate_single_bootstrap_sample(
              random_state=rs[i],
              data=data,
              annotated_functions=annotated_functions,
              sensitive_feature_names=sensitive_feature_names,
              control_feature_names=control_feature_names,
          )
          result.append(nxt)
  
      return result
  
file_path: fairlearn/fairlearn/metrics/_bootstrap.py
imports: import logging
  from typing import Dict, List, Optional, Union
  import numpy
  import pandas
  from ._annotated_metric_function import AnnotatedMetricFunction
  from ._disaggregated_result import DisaggregatedResult
label_desc: Use image node_id 2 for calling a global function with example usage: generate_bootstrap_samples() and returns: result