clone from http://code.google.com/p/geoip-udf/