def METHOD_NAME(cache):
    cache._mor['foo_instance'] = {}
    for i in range(9):
        cache._mor['foo_instance'][i] = {'mor_type': 'datastore', 'metrics': range(5)}
    # input size is multiple of batch size
    steps = 0
    for mors in cache.mors_batch('foo_instance', 3):
        assert len(mors) == 3
        steps += 1
    assert steps == 3
    # batch size is smaller than the input size
    out = list(cache.mors_batch('foo_instance', 5))
    assert len(out) == 2
    assert len(out[0]) == 5
    assert len(out[1]) == 4
    # batch size is the same as the input size
    out = list(cache.mors_batch('foo_instance', 9))
    assert len(out) == 1
    assert len(out[0]) == 9
    # batch size is greater than the input size
    out = list(cache.mors_batch('foo_instance', 100))
    assert len(out) == 1
    assert len(out[0]) == 9
    # input size is multiple of batch size
    steps = 0
    for mors in cache.mors_batch('foo_instance', 3, max_historical_metrics=16):
        assert len(mors) == 3
        assert sum([len(mors[m]['metrics']) for m in mors]) == 15
        steps += 1
    assert steps == 3
    steps = 0
    for mors in cache.mors_batch('foo_instance', 3, max_historical_metrics=9):
        assert len(mors) == 1
        assert sum([len(mors[m]['metrics']) for m in mors]) == 5
        steps += 1
    assert steps == 9
    steps = 0
    for mors in cache.mors_batch('foo_instance', 3, max_historical_metrics=6):
        assert len(mors) == 1
        assert sum([len(mors[m]['metrics']) for m in mors]) == 5
        steps += 1
    assert steps == 9
    steps = 0
    for _ in cache.mors_batch('foo_instance', 3, max_historical_metrics=4):
        steps += 1
    assert steps == 0