[ip] use pygeoip and socket instead of rscript

This is a work in progress.
Fix issue #265
Convert to 4.0 standard as per issue #276