def polygon_to_points( poly ):
    """
        
    Plotting helper, which rearranges polygon vertices into lists
    of X and Y coordinates. The first point is duplicated at the end
    of each list, to make a closed path.
        
    :Parameters:

    poly: tuple of ((x1,y1),(x2,y2),...)
        The coordinates of the vertices of the polygon.

    :Returns:

    (xlist, ylist): list of 2 tuples
        ((x1, x2, ..., x1), (y1, y2, ..., y1))
         
    """
    xlist = []
    ylist = []
    for vertex in poly:
        xlist.append(vertex[0])
        ylist.append(vertex[1])
    xlist.append(xlist[0])
    ylist.append(ylist[0])
    return (xlist, ylist)