reduce(lambda x,y: (x[0],x[0].__setitem__(y[0],x[0][y[0]].union(y[1]))),map(lambda x:(re.match(r'(www\.)?(.*)',x[0]).group(2),x[1]),l),(defaultdict(set),))[0].items()
CREATE TABLE country_polygon AS
SELECT points.country, ST_MakePolygon(ST_MakeLine(ST_MakePoint(points.longitude, points.latitude) ORDER BY points.num)) As geom
FROM points
GROUP BY points.country;
SELECT ST_Contains(geom,point) FROM country_polygon;