def METHOD_NAME(op, *args, **kwargs):
    func = op.func
    groupers = [
        grouper
        for grouper in (getattr(arg, "grouper", None) for arg in args)
        if grouper is not None
    ]
    # all grouping keys must be identical
    assert all(groupers[0] == grouper for grouper in groupers[1:])
    # we're performing a scalar operation on grouped column, so
    # perform the operation directly on the underlying Series
    # and regroup after it's finished
    args = [getattr(arg, "obj", arg) for arg in args]
    groupings = get_grouping(groupers[0].groupings)
    return func(*args).groupby(groupings, group_keys=False)