'Parse the search results and return valid torrent list'

def search(self, searchurl):

    try:
        headers = {'Referer': self.search_referer}
        r = self.session.get(url=searchurl, headers=headers, timeout=self.timeout)
        soup = BeautifulSoup(r.content, 'html5lib')
        if (not self.still_logged_in(soup)):
            self.login()
            r = self.session.get(url=searchurl, timeout=self.timeout)
            soup = BeautifulSoup(r.content, 'html5lib')
            if (not self.still_logged_in(soup)):
                logger.error('Error    getting    rutracker    data')
                return None
        rulist = []
        i = soup.find('table', id='tor-tbl')
        if (not i):
            logger.info('No    valid    results    found    from    rutracker')
            return None
        minimumseeders = (int(headphones.CONFIG.NUMBEROFSEEDERS) - 1)
        for item in zip(i.find_all(class_='hl-tags'), i.find_all(class_='dl-stub'), i.find_all(class_='seedmed')):
            title = item[0].get_text()
            url = item[1].get('href')
            size_formatted = item[1].get_text()[:(-2)]
            seeds = item[2].get_text()
            size_parts = size_formatted.split()
            size = float(size_parts[0])
            if (size_parts[1] == 'KB'):
                size *= 1024
            if (size_parts[1] == 'MB'):
                size *= (1024 ** 2)
            if (size_parts[1] == 'GB'):
                size *= (1024 ** 3)
            if (size_parts[1] == 'TB'):
                size *= (1024 ** 4)
            if ((size < self.maxsize) and (minimumseeders < int(seeds))):
                logger.info(('Found    %s.    Size:    %s' % (title, size_formatted)))
                torrent_id = dict([part.split('=') for part in urlparse(url)[4].split('&')])['t']
                topicurl = ('http://rutracker.org/forum/viewtopic.php?t=' + torrent_id)
                rulist.append((title, size, topicurl, 'rutracker.org', 'torrent', True))
            else:
                logger.info(('%s    is    larger    than    the    maxsize    or    has    too    little    seeders    for    this    category,    skipping.    (Size:    %i    bytes,    Seeders:    %i)' % (title, size, int(seeds))))
        if (not rulist):
            logger.info('No    valid    results    found    from    rutracker')
        return rulist
    except Exception as e:
        logger.error(('An    unknown    error    occurred    in    the    rutracker    parser:    %s' % e))
        return None
