The problem I was trying to solve was a clean and quick way to get the country code quickly for a range of ip addresses. There are many available libraries out there to do this but the one I found to be the easiest to use is provided via a web service which can be accessed from any scripting language to automate the process.
The only step required is a quick and free signup for an api key from this URL: http://ipinfodb.com/ip_location_api.php
Then you can use the service like this:
Which will return something like follows in your web browser:
OK;;18.104.22.168;US;UNITED STATES;CALIFORNIA;MOUNTAIN VIEW;94043;37.3861;-122.084;-08:00