<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def grouping(f=None, interaction=['call', 'text'], summary='default', user_kwd=False):
 """ ``grouping`` is a decorator for indicator functions, used to simplify the source code. Parameters f : function The function to decorate user_kwd : boolean If user_kwd is True, the user object will be passed to the decorated function interaction : 'call', 'text', 'location', or a list By default, all indicators use only 'call' and 'text' records, but the interaction keywords filters the records passed to the function. summary: 'default', 'extended', None An indicator returns data statistics, ether *mean* and *std* by default, more with 'extended', or the inner distribution with None. See :meth:`~bandicoot.helper.group.statistics` for more details. See :ref:`new-indicator-label` to learn how to write an indicator with this decorator. """


    if f is None:
        return partial(grouping, user_kwd=user_kwd, interaction=interaction,
                       summary=summary)

    def wrapper(user, groupby='week', interaction=interaction, summary=summary,
                split_week=False, split_day=False, filter_empty=True,
                datatype=None, **kwargs):

        if interaction is None:
            interaction = ['call', 'text']
        parameters = divide_parameters(split_week, split_day, interaction)

        operations = {
            'grouping': {
                'using': 'records',
                'binning': False,
                'groupby': groupby,
                'filter_empty': filter_empty,
                'divide_by': parameters
            }, 'apply': {
                'user_kwd': user_kwd,
                'summary': summary,
                'kwargs': kwargs
            }
        }

        for i in parameters['interaction']:
            if i not in ['callandtext', 'call', 'text', 'location']:
                raise ValueError("%s is not a valid interaction value. Only "
                                 "'call', 'text', and 'location' are accepted."
                                 % i)

        return _generic_wrapper(f, user, operations, datatype)

    return advanced_wrap(f, wrapper)