def to_dic(self):
        json_dic = {}
        elements = sorted([int(self.all_elements[i]) for i in range(len(self.all_elements))])
        elements.append(-1) #capping
        str_elements = ""
        start = elements[0]
        for i in range(1,len(elements)):
            if elements[i-1] != elements[i]-1 :
                if elements[i-1] == start:
                    str_elements += str(start)+", "
                    start = elements[i]
                else:
                    str_elements += str(start)+":"+str(elements[i-1])+", "
                    start = elements[i]
        json_dic["elements"] =str_elements[:-2]

        if self.prototype is not None:
            json_dic["prototype"] = int(self.prototype)

        if self.id != "":
            json_dic["id"] = self.id

        return json_dic
Converts this cluster into a dictionary (to be used with json serializers).
dataset/ETHPy150Open victor-gil-sepulveda/pyProCT/pyproct/clustering/cluster.py/Cluster.to_dic