To use mygeoip, first install it using pip:
$ pip install mygeoip
For example:
>>> import mygeoip as t >>> k=t.findcity(ipaddress)