def geocode(self, query, **kwargs):
        """
        Given a string to search for, return the results from OpenCage's Geocoder.

        :param string query: String to search for

        :returns: Dict results
        :raises InvalidInputError: if the query string is not a unicode string
        :raises RateLimitExceededError: if you have exceeded the number of queries you can make. Exception says when you can try again
        :raises UnknownError: if something goes wrong with the OpenCage API

        """
        if six.PY2:
            # py3 doesn't have unicode() function, and instead we check the text_type later
            try:
                query = unicode(query)
            except UnicodeDecodeError:
                raise InvalidInputError(bad_value=query)

        if not isinstance(query, six.text_type):
            raise InvalidInputError(bad_value=query)

        data = {
            'q': query,
            'key': self.key
        }
        # Add user parameters
        data.update(kwargs) 
        
        url = self.url
        response = requests.get(url, params=data)

        if (response.status_code == 402 or response.status_code == 429):
            # Rate limit exceeded
            reset_time = datetime.utcfromtimestamp(response.json()['rate']['reset'])
            raise RateLimitExceededError(reset_to=int(response.json()['rate']['limit']), reset_time=reset_time)

        elif response.status_code == 500:
            raise UnknownError("500 status code from API")

        try:
            response_json = response.json()
        except __HOLE__:
            raise UnknownError("Non-JSON result from server")

        if 'results' not in response_json:
            raise UnknownError("JSON from API doesn't have a 'results' key")


        return floatify_latlng(response_json['results'])
dataset/ETHPy150Open OpenCageData/python-opencage-geocoder/opencage/geocoder.py/OpenCageGeocode.geocode