Looks up the url_ending to obtain information about the short url.

        If it exists, the API will return a dictionary with information, including
        the long_url that is the destination of the given short url URL.


        The lookup object looks like something like this:

        .. code-block:: python

            {
                'clicks': 42,
                'created_at':
                    {
                        'date': '2017-12-03 00:40:45.000000',
                        'timezone': 'UTC',
                        'timezone_type': 3
                    },
                'long_url': 'https://stackoverflow.com/questions/tagged/python',
                'updated_at':
                    {
                        'date': '2017-12-24 13:37:00.000000',
                        'timezone': 'UTC',
                        'timezone_type': 3
                    }
            }

        :param str lookup_url: An url ending or full short url address
        :param url_key: optional URL ending key for lookups against secret URLs
        :type url_key: str or None
        :return: Lookup dictionary containing, among others things, the long url; or None if not existing
        :rtype: dict or None

def lookup(self, lookup_url, url_key=None):
        """
        Looks up the url_ending to obtain information about the short url.

        If it exists, the API will return a dictionary with information, including
        the long_url that is the destination of the given short url URL.


        The lookup object looks like something like this:

        .. code-block:: python

            {
                'clicks': 42,
                'created_at':
                    {
                        'date': '2017-12-03 00:40:45.000000',
                        'timezone': 'UTC',
                        'timezone_type': 3
                    },
                'long_url': 'https://stackoverflow.com/questions/tagged/python',
                'updated_at':
                    {
                        'date': '2017-12-24 13:37:00.000000',
                        'timezone': 'UTC',
                        'timezone_type': 3
                    }
            }

        :param str lookup_url: An url ending or full short url address
        :param url_key: optional URL ending key for lookups against secret URLs
        :type url_key: str or None
        :return: Lookup dictionary containing, among others things, the long url; or None if not existing
        :rtype: dict or None
        """
        url_ending = self._get_ending(lookup_url)
        params = {
            'url_ending': url_ending,
            'url_key': url_key
        }
        data, r = self._make_request(self.api_lookup_endpoint, params)
        if r.status_code == 401:
            if url_key is not None:
                raise exceptions.UnauthorizedKeyError('given url_key is not valid for secret lookup.')
            raise exceptions.UnauthorizedKeyError
        elif r.status_code == 404:
            return False  # no url found in lookup
        action = data.get('action')
        full_url = data.get('result')
        if action == 'lookup' and full_url is not None:
            return full_url
        raise exceptions.DebugTempWarning