<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def cluster_number(self, data, maxgap): 
        '''General function that clusters numbers.

        Args
            data (list): list of integers.
            maxgap (int): max gap between numbers in the cluster.

        '''

        data.sort()
        groups = [[data[0]]]
        for x in data[1:]:
            if abs(x - groups[-1][-1]) <= maxgap:
                groups[-1].append(x)
            else:
                groups.append([x])
        return groups