<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary(self, func=methodcaller('sum'), title='Total', axis=0, subset=None, *args, **kwargs):
 """Add multiple summary rows or columns to the dataframe. Parameters :param func: function to be used for a summary. :param titles: Title for this summary column. :param axis: Same as numpy and pandas axis argument. A value of None will cause the summary to be applied to both rows and columns. :param args: Positional arguments passed to all the functions. :param kwargs: Keyword arguments passed to all the functions. The results of summary can be chained together. """


        if axis is None:
            return (
                self
                .summary(
                    func=func,
                    title=title,
                    axis=0,
                    subset=subset,
                    *args,
                    **kwargs
                )
                .summary(
                    func=func,
                    title=title,
                    axis=1,
                    subset=subset,
                    *args,
                    **kwargs
                )
            )
        else:
            agg = Aggregate(title, func, subset=subset,
                            axis=axis, *args, **kwargs)
            return self._add_summary(agg)