<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def aggregate(self, variable, components=None, append=False):
 """Compute the aggregate of timeseries components or sub-categories Parameters variable: str variable for which the aggregate should be computed components: list of str, default None list of variables, defaults to all sub-categories of `variable` append: bool, default False append the aggregate timeseries to `data` and return None, else return aggregate timeseries """

        # default components to all variables one level below `variable`
        components = components or self._variable_components(variable)

        if not len(components):
            msg = 'cannot aggregate variable `{}` because it has no components'
            logger().info(msg.format(variable))

            return

        rows = self._apply_filters(variable=components)
        _data = _aggregate(self.data[rows], 'variable')

        if append is True:
            self.append(_data, variable=variable, inplace=True)
        else:
            return _data