<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_grades(self, site):
 """ Gets a list of grades associated with a site. The return type is a dictionary whose keys are assignment categories, similar to how the page is laid out in TSquare. """

        tools = self.get_tools(site)
        grade_tool_filter = [x.href for x in tools if x.name == 'gradebook-tool']
        if not grade_tool_filter:
            return []
        response = self._session.get(grade_tool_filter[0])
        response.raise_for_status()
        iframes = self._html_iface.get_iframes(response.text)
        iframe_url = ''
        for frame in iframes:
            if frame['title'] == 'Gradebook ':
                iframe_url = frame['src']
        if iframe_url == '':
            print "WARNING: NO GRADEBOOK IFRAMES FOUND"
        response = self._session.get(iframe_url)
        response.raise_for_status()
        grade_dict_list = self._html_iface.get_grades(response.text)
        return grade_dict_list