code: def search(self, terms, category=Category.all_categories, page=1,
                 sort_key=SearchSortKey.date,
                 order_key=SearchOrderKey.descending):
          params = {
              'page': 'search',
              'term': terms,
              'cats': category.value,
              'sort': sort_key.value,
              'order': order_key.value,
          }
          r = requests.get(self.base_url, params=params)
          content = self._get_page_content(r)
          a_to_last_page = content.findall('.//div[@class="rightpages"]/a[2]')
          if not a_to_last_page:
              total_pages = 1
          else:
              last_page_url = a_to_last_page[0].attrib['href']
              offset = extract_url_query_parameter(last_page_url, "offset")[0]
              total_pages = int(offset)
          torrent_stubs = []
          rows = (x for x in content.findall('.//table//tr')
                  if 'tlistrow' in x.attrib.get('class', ''))
          for row in rows:
              cell_td_elems = row.findall('td')
              category_value = extract_url_query_parameter(
                  cell_td_elems[0].find('a').attrib['href'],
                  'cats')[0]
              category = Category.lookup_category(category_value)
              torrent_id = extract_url_query_parameter(
                  cell_td_elems[1].find('a').attrib['href'],
                  "tid")[0]
              name = cell_td_elems[1].find('a').text
              file_size = cell_td_elems[3].text
              if cell_td_elems[4].text.isdigit():
                  seeders = int(cell_td_elems[4].text)
              else:
                  seeders = None
              if cell_td_elems[5].text.isdigit():
                  leechers = int(cell_td_elems[5].text)
              else:
                  leechers = None
              downloads = int(cell_td_elems[6].text)
              stub = TorrentStub(torrent_id, name, category, seeders, leechers,
                                 file_size, downloads)
              torrent_stubs.append(stub)
          return SearchResultPage(
              terms, category, sort_key, order_key, page, total_pages,
              torrent_stubs)