def _get_component_from_result(self, result, lookup):
        """
        Helper function to get a particular address component from a Google result.

        Since the address components in results are an array of objects containing a types array,
        we have to search for a particular component rather than being able to look it up directly.

        Returns the first match, so this should be used for unique component types (e.g.
        'locality'), not for categories (e.g. 'political') that can describe multiple components.

        :arg dict result: A results dict with an 'address_components' key, as returned by the
                          Google geocoder.
        :arg dict lookup: The type (e.g. 'street_number') and key ('short_name' or 'long_name') of
                          the desired address component value.
        :returns: address component or empty string
        """
        for component in result['address_components']:
            if lookup['type'] in component['types']:
                return component.get(lookup['key'], '')
        return ''
Helper function to get a particular address component from a Google result.

        Since the address components in results are an array of objects containing a types array,
        we have to search for a particular component rather than being able to look it up directly.

        Returns the first match, so this should be used for unique component types (e.g.
        'locality'), not for categories (e.g. 'political') that can describe multiple components.

        :arg dict result: A results dict with an 'address_components' key, as returned by the
                          Google geocoder.
        :arg dict lookup: The type (e.g. 'street_number') and key ('short_name' or 'long_name') of
                          the desired address component value.
        :returns: address component or empty string