'Check if a specified number of torrent has been added to the passed source.'

def check_torrents(self, src, target=1):

    defer_param = defer.Deferred()
    def do_check():
        src_obj = self.boosting_manager.get_source_object(src)
        if (src_obj and (len(src_obj.torrents) >= target)):
            def _get_tor_dummy(_, keys=123, include_mypref=True):
                '\n                                                                                function    to    emulate    get_torrent    in    torrent_db\n                                                                                '
                return {'C.torrent_id': 93, 'category': u'Compressed', 'torrent_id': 41, 'infohash': src_obj.torrents.keys()[0], 'length': 1150844928, 'last_tracker_check': 10001, 'myDownloadHistory': False, 'name': u'ubuntu-15.04-desktop-amd64.iso', 'num_leechers': 999, 'num_seeders': 123, 'status': u'unknown', 'tracker_check_retries': 0}
            self.boosting_manager.torrent_db.getTorrent = _get_tor_dummy
            self.session.notifier.notify(NTFY_TORRENTS, NTFY_UPDATE, src_obj.torrents.keys()[0])
            self.boosting_manager.log_statistics()
            self._check_torrents_lc.stop()
            self._check_torrents_lc = None
            defer_param.callback(src)
    self._check_torrents_lc = LoopingCall(do_check)
    self._check_torrents_lc.start(1, now=True)
    return defer_param
