(self, ip_address)
return (iso_code, latitude, longitude, country_name, city)
Perform a IP to geolocation lookup.

        Args:
            ip_address - the IPv4 or IPv6 address to geolocate

        Returns:
            Either:
            A tuple comprising of the following in order
            - iso_code (str) - the ISO 31661 alpha-2 code of the country
            - latitude (str) - the north-south coordinate
            - longitude (str) - the east-west coordinate
            - country_name (str) - the full country name
            - city (str) - the city name that approximates the location
            Or None:
            - when the IP address does not have a resolvable location
Perform a IP to geolocation lookup.
Perform a IP to geolocation lookup .
def ip2geo(self, ip_address) -> Union[Tuple[str, str, str, str, str], None]:
        """Perform a IP to geolocation lookup.

        Args:
            ip_address - the IPv4 or IPv6 address to geolocate

        Returns:
            Either:
            A tuple comprising of the following in order
            - iso_code (str) - the ISO 31661 alpha-2 code of the country
            - latitude (str) - the north-south coordinate
            - longitude (str) - the east-west coordinate
            - country_name (str) - the full country name
            - city (str) - the city name that approximates the location
            Or None:
            - when the IP address does not have a resolvable location
        """
        try:
            response = self.city(ip_address)
        except geoip2.errors.AddressNotFoundError:
            logging.debug('IP address {0} not found.'.format(ip_address))
            return None
        except geoip2.errors.GeoIP2Error as error:
            logging.error('Error while geolocating {0} - {1}'.format(
                ip_address, error))
            return None

        latitude = response.location.latitude
        longitude = response.location.longitude
        country_name = response.country.name
        iso_code = response.country.iso_code
        city = response.city.name

        return (iso_code, latitude, longitude, country_name, city)
def ip2geo ( self , ip_address ) -> Union [ Tuple [ str , str , str , str , str ] , None ] : try : response = self . city ( ip_address ) except geoip2 . errors . AddressNotFoundError : logging . debug ( 'IP address {0} not found.' . format ( ip_address ) ) return None except geoip2 . errors . GeoIP2Error as error : logging . error ( 'Error while geolocating {0} - {1}' . format ( ip_address , error ) ) return None latitude = response . location . latitude longitude = response . location . longitude country_name = response . country . name iso_code = response . country . iso_code city = response . city . name return ( iso_code , latitude , longitude , country_name , city )