docs: def bulk(self, actions, stats_only=False, verbose=False, **kwargs):
          """
          Helper for the :meth:`~elasticsearch.Elasticsearch.bulk` api that provides
          a more human friendly interface - it consumes an iterator of actions and
          sends them to elasticsearch in chunks. It returns a tuple with summary
          information - number of successfully executed actions and either list of
          errors or number of errors if `stats_only` is set to `True`.
          See :func:`~elasticsearch.helpers.streaming_bulk` for more accepted
          parameters
          :arg actions: iterator containing the actions
          :arg stats_only: if `True` only report number of successful/failed
              operations instead of just number of successful and a list of error responses
          Any additional keyword arguments will be passed to
          :arg verbose: return verbose data: (inserted, errors)
          :func:`~elasticsearch.helpers.streaming_bulk` which is used to execute
          the operation.
          """
  
          inserted = []
          errors = []
          all = []
          for deferred_bulk in self.streaming_bulk(actions, **kwargs):
              bulk_results = yield deferred_bulk
              for ok, item in bulk_results:
                  # go through request-response pairs and detect failures
                  all.append((ok, item))
                  l = inserted if ok else errors
                  l.append(item)
  
          if verbose:
              returnValue(all)
  
          if stats_only:
              returnValue((len(inserted), len(errors)))
  
          # here for backwards compatibility
          returnValue((len(inserted), errors))