def find_min_max(shape):
    """Finds min/max coordinates for a given shape and returns a tuple
    of the form (minx, maxx, miny, maxy)
    shape: list with points"""
    minx = miny = 1000
    maxx = maxy = -1000
    for x, y in shape:
        if x < minx:
            minx = x
        if x > maxx:
            maxx = x
        if y < miny:
            miny = y
        if y > maxy:
            maxy = y
    return (minx, maxx, miny, maxy)