code: def get_magnet(self, detailed=True):
          
          result = 'magnet:?xt=urn:btih:' + self.info_hash
  
          def add_tr():
              urls = self.announce_urls
              if not urls:
                  return
  
              trackers = []
  
              urls = urls[0]  # Only primary announcers are enough.
              for url in urls:
                  trackers.append(('tr', url))
  
              if trackers:
                  return urlencode(trackers)
  
          def add_ws():
              webseeds = [('ws', url) for url in self.webseeds]
              if webseeds:
                  return urlencode(webseeds)
  
          params_map = {
              'tr': add_tr,
              'ws': add_ws,
          }
  
          if detailed:
              details = []
  
              if isinstance(detailed, _ITERABLE_TYPES):
                  requested_params = detailed
              else:
                  requested_params = params_map.keys()
  
              for param in requested_params:
                  param_val = params_map[param]()
                  param_val and details.append(param_val)
  
              if details:
                  result += '&%s' % '&'.join(details)
  
          return result
docs: Returns torrent magnet link, consisting of BTIH (BitTorrent Info Hash) URN
          anr optional other information.
  
          :param bool|list|tuple|set detailed:
              For boolean - whether additional info (such as trackers) should be included.
              For iterable - expected allowed parameter names:
                  tr - trackers
                  ws - webseeds