def points_bounds(points):
    """Return bounding rect of 2D point list (as 4-tuple of min X, min Y,
    max X, max Y)."""
    min_x, min_y, max_x, max_y = (
        points[0][0],
        points[0][1],
        points[0][0],
        points[0][1],
    )
    for point in points[1:]:
        min_x = min(min_x, point[0])
        min_y = min(min_y, point[1])
        max_x = max(max_x, point[0])
        max_y = max(max_y, point[1])
    return (min_x, min_y, max_x, max_y)