def remove_dup_and_null(cell):
    """ Remove duplicated coordinate sets and NULLs from a comma separated string """

    ## Split the cell by commas and convert it to a set, this removes duplicated elements
    set_cell = set(cell.split(','))

    ## Keep NULLs if it's the only entry in a cell, else, remove NULLs
    if "NULL" in set_cell and len(set_cell) > 1:
        set_cell.remove("NULL")

    ## Join the set
    if len(set_cell) > 1:
        sorted_cell = sorted(set_cell, key=lambda x: int(x.split(":")[0]))
    else:
        sorted_cell = set_cell
    new_cell = ",".join(sorted_cell)
    return new_cell