This is a free geolocation / geotargeting service which can be queried through HTTP (for example, from a Google App Engine application). To use it, just fetch a URL like:

http://geoip.wtanaka.com/cc/72.14.235.121

or

http://geoip.wtanaka.com/cc/203.208.35.100

You will receive a lower-case ISO 3166-1 alpha-2 country code. If you need a small flag icon for that country code, you can hot link one from this site using a URL like:

http://geoip.wtanaka.com/flag/us.gif

or

http://geoip.wtanaka.com/flag/cn.gif

Some example client code is available at the geo-ip-location google code wiki