def METHOD_NAME(self, key, batch_size, max_historical_metrics=None):
    """
    Generator returning as many dictionaries containing `batch_size` Mor
    objects as needed to iterate all the content of the cache. This has
    to be iterated twice, like:
        for batch in cache.mors_batch('key', 100):
            for name, mor in batch:
                # use the Mor object here
    If max_historical_metrics is specified, the function will also limit
    the size of the batch so that the integration never makes an API call
    with more than this given amount of historical metrics.
    """
    if max_historical_metrics is None:
        max_historical_metrics = float('inf')
    with self._mor_lock:
        mors_dict = self._mor.get(key) or {}
        batch = {}
        nb_hist_metrics = 0
        for mor_name, mor in iteritems(mors_dict):
            if mor['mor_type'] not in REALTIME_RESOURCES and mor.get('metrics'):
                # Those metrics are historical, let's make sure we don't have too
                # many of them in the same batch.
                if len(mor['metrics']) >= max_historical_metrics:
                    # Too many metrics to query for a single mor, ignore it
                    self.log.warning(
                        "Metrics for '%s' are ignored because there are more (%d) than what you allowed (%d) on vCenter Server",  # noqa: E501
                        mor_name,
                        len(mor['metrics']),
                        max_historical_metrics,
                    )
                    continue
                nb_hist_metrics += len(mor['metrics'])
                if nb_hist_metrics >= max_historical_metrics:
                    # Adding those metrics to the batch would make it too big, yield it now
                    self.log.info("Will request %d hist metrics", nb_hist_metrics - len(mor['metrics']))
                    yield batch
                    batch = {}
                    nb_hist_metrics = len(mor['metrics'])
            batch[mor_name] = mor
            if len(batch) == batch_size:
                self.log.info("Will request %d hist metrics", nb_hist_metrics)
                yield batch
                batch = {}
                nb_hist_metrics = 0
        if batch:
            self.log.info("Will request %d hist metrics", nb_hist_metrics)
            yield batch