code: def protocol_prio(streams, priolist):
      
      # Map score's to the reverse of the list's index values
      proto_score = dict(zip(priolist, range(len(priolist), 0, -1)))
      logging.debug("Protocol priority scores (higher is better): %s", str(proto_score))
  
      # Build a tuple (bitrate, proto_score, stream), and use it
      # for sorting.
      prioritized = [(s.bitrate, proto_score[s.name], s) for
                     s in streams if s.name in proto_score]
      return [x[2] for x in sorted(prioritized, key=itemgetter(0, 1), reverse=True)]
docs: Given a list of VideoRetriever objects and a prioritized list of
      accepted protocols (as strings) (highest priority first), return
      a list of VideoRetriever objects that are accepted, and sorted
      by bitrate, and then protocol priority.