<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def medial_axis(polygon, resolution=None, clip=None):
 """ Given a shapely polygon, find the approximate medial axis using a voronoi diagram of evenly spaced points on the boundary of the polygon. Parameters polygon : shapely.geometry.Polygon The source geometry resolution : float Distance between each sample on the polygon boundary clip : None, or (2,) int Clip sample count to min of clip[0] and max of clip[1] Returns edges : (n, 2) int Vertex indices representing line segments on the polygon's medial axis vertices : (m, 2) float Vertex positions in space """

    from scipy.spatial import Voronoi

    if resolution is None:
        resolution = .01

    # get evenly spaced points on the polygons boundaries
    samples = resample_boundaries(polygon=polygon,
                                  resolution=resolution,
                                  clip=clip)
    # stack the boundary into a (m,2) float array
    samples = stack_boundaries(samples)
    # create the voronoi diagram on 2D points
    voronoi = Voronoi(samples)
    # which voronoi vertices are contained inside the polygon
    contains = vectorized.contains(polygon, *voronoi.vertices.T)
    # ridge vertices of -1 are outside, make sure they are False
    contains = np.append(contains, False)
    # make sure ridge vertices is numpy array
    ridge = np.asanyarray(voronoi.ridge_vertices, dtype=np.int64)
    # only take ridges where every vertex is contained
    edges = ridge[contains[ridge].all(axis=1)]

    return edges, voronoi.vertices