<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, func, *columns):
 """ Execute an aggregate function against the database :param func: The aggregate function :type func: str :param columns: The columns to execute the fnction for :type columns: tuple :return: The aggregate result :rtype: mixed """

        if not columns:
            columns = ["*"]

        self.aggregate_ = {"function": func, "columns": columns}

        previous_columns = self.columns

        results = self.get(*columns).all()

        self.aggregate_ = None

        self.columns = previous_columns

        if len(results) > 0:
            return dict((k.lower(), v) for k, v in results[0].items())["aggregate"]