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