def limit_er(expectedrows):
    """Protection against creating too small or too large chunks or slices."""
    if expectedrows < 10 ** 5:
        expectedrows = 10 ** 5
    elif expectedrows > 10 ** 12:
        expectedrows = 10 ** 12
    return expectedrows
