code: def _chooseConnection(ctype, name, results):
      
      # At this point we have a list of result tuples containing (url, token, PlexServer, runtime)
      # or (url, token, None, runtime) in the case a connection could not be established.
      for url, token, result, runtime in results:
          okerr = 'OK' if result else 'ERR'
          log.info('%s connection %s (%ss): %s?X-Plex-Token=%s', ctype, okerr, runtime, url, token)
      results = [r[2] for r in results if r and r[2] is not None]
      if results:
          log.info('Connecting to %s: %s?X-Plex-Token=%s', ctype, results[0]._baseurl, results[0]._token)
          return results[0]
      raise NotFound('Unable to connect to %s: %s' % (ctype.lower(), name))
docs: Chooses the first (best) connection from the given _connect results.