code: def _choose_num_bootstraps(sample_size, mean_size, fuel):
      """Choose how many bootstraps to do.
  
      The fuel is the total number floats we get to draw from
      `np.random.choice`, which is a proxy for the amount of time we're
      allowed to spend bootstrapping.  We choose how many bootstraps to
      do to make sure we fit in our budget.
  
      Args:
        sample_size: Size of sample we are bootstrapping from.
        mean_size: Number of samples reduced to form each mean estimate.
        fuel: Total number of floats chosen in the bootstrap, as a proxy
          for total work spent bootstrapping.
  
      Returns:
        num_bootstraps: Number of bootstraps to do.
      """
      # We ignore the sample size here because the asymptotics of
      # np.random.choice should be O(n log n + k) where n is the input
      # size and k is the output size, and the fuel limit is only binding
      # in the regime where k >> n.
      num_bootstraps = int(fuel / mean_size)
      # However, we always have at least as many bootstraps as we've
      # already drawn samples, because in that limit we can just slice the
      # existing array.
      if num_bootstraps * mean_size <= sample_size:
          num_bootstraps = int(sample_size / mean_size)
      return num_bootstraps
  
imports: import collections
  import numpy
  import scipy.optimize
  import scipy.stats
label_desc: Use image node_id 2 for calling a global function with example usage: _choose_num_bootstraps(sample_size, mean_size, fuel) and returns: num_bootstraps