'Stopping torrent that currently downloading'

def stop_download(self, torrent):

    ihash = lt.big_number(torrent['metainfo'].get_infohash())
    self._logger.info('Stopping    %s', str(ihash))
    download = torrent.pop('download', False)
    lt_torrent = self.session.lm.ltmgr.get_session().find_torrent(ihash)
    if (download and lt_torrent.is_valid()):
        self._logger.info('Writing    resume    data    for    %s', str(ihash))
        download.save_resume_data()
        self.session.remove_download(download, hidden=True)
