import random


def multi(fmt_function, mn, mx):
    """
    Wrap a gen function that normally returns a single value so that it
    generates and returns a random number of values between `mn` and
    `mx`.
    """
    def gen(record):
        num = random.randint(mn, mx)
        return [fmt_function(record) for _ in range(0, num)] or None
    return gen