<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_gfy(self, gfyname):
 """ Query a gfy name for URLs and more information. """

        self.check_token()
        
        r = requests.get(QUERY_ENDPOINT + gfyname, headers=self.headers)
        
        response = r.json()
        
        if r.status_code != 200 and not ERROR_KEY in response:
            raise GfycatClientError('Bad response from Gfycat',
                                    r.status_code)
        elif ERROR_KEY in response:
            raise GfycatClientError(response[ERROR_KEY], r.status_code)
        
        return response