code: def _sample_batch():
      
      if _sample_probability == 1.0 or random.random() < _sample_probability:
          return True
  
      # Pop off all the metrics for the batch
      for database in _measurements:
          _measurements[database] = _measurements[database][_max_batch_size:]
      return False
docs: Determine if a batch should be processed and if not, pop off all of
      the pending metrics for that batch.
  
      :rtype: bool