def METHOD_NAME(iterable, keyfunc):
    """
    Group items of iterable in groups such that the result of applying keyfunc
    to them is consecutive.
    """
    if keyfunc is None:
        keyfunc = lambda x: x
    return groupby(iterable, lambda i, c=count(): keyfunc(i)-next(c))