def extent_to_wkt(extent):
    """Create a Polygon WKT geometry from extent: (xmin, ymin, xmax, ymax)"""
    wkt = "POLYGON(("
    for dx, dy in ((0, 0), (0, 1), (1, 1), (1, 0)):
        wkt += "{0} {1},".format(str(extent[2 * dx]), str(extent[2 * dy + 1]))
    wkt += "{0} {1}))".format(str(extent[0]), str(extent[1]))
    return wkt