'Searches for torrents using SearchCommunity with the given keywords.
:param keywords: The given keywords.'

@call_on_reactor_thread
def search_for_torrents(self, keywords):

    nr_requests_made = 0
    if (self.dispersy is None):
        return nr_requests_made
    for community in self.dispersy.get_communities():
        if isinstance(community, SearchCommunity):
            self._current_keywords = keywords
            nr_requests_made = community.create_search(keywords)
            if (not nr_requests_made):
                self._logger.warn('Could    not    send    search    in    SearchCommunity,    no    verified    candidates    found')
            break
    return nr_requests_made
