def get_geolocation(all_the_ip_address):
 print 'Getting geo information...'
 updated_addresses = []
 counter = 1
 header_row = all_the_ip_address.pop(0)
 header_row.extend(['Country', 'City'])
 for line in all_the_ip_address:
  print 'Grabbing geo info for row # {0}'.format(counter)
  r = requests.get('https://freegeoip.net/json/{0}'.format(line[0]))
  line.extend([str(r.json()['country_name']), str(r.json()['city'])])
  updated_addresses.append(line)
  counter += 1
 updated_addresses.insert(0, header_row)
 return updated_addresses

def get_geolocation ( all_the_ip_address ) : print 'Getting geo information...' updated_addresses = [ ] counter = 1 header_row = all_the_ip_address . pop ( 0 ) header_row . extend ( [ 'Country' , 'City' ] ) for line in all_the_ip_address : print 'Grabbing geo info for row # {0}' . format ( counter ) r = requests . get ( 'https://freegeoip.net/json/{0}' . format ( line [ 0 ] ) ) line . extend ( [ str ( r . json ( ) [ 'country_name' ] ) , str ( r . json ( ) [ 'city' ] ) ] ) updated_addresses . append ( line ) counter += 1 updated_addresses . insert ( 0 , header_row ) return updated_addresses
given a list of lists from get_addresses() .