code: def priority(self,priority):
          
          with self.__lock:
              old_priorities = {}
              try:
                  for thread in self.__threads:
                      old_priorities[thread] = thread.priority
                      thread.priority = priority
              except Exception:
                  for (thread,old_priority) in old_priorities.iteritems():
                      try:
                          thread.priority = old_priority
                      except Exception:
                          pass
                  raise
              else:
                  self.__priority = priority
docs: Set the priority for all threads in this group.
  
          If setting priority fails on any thread, the priority of all threads
          is restored to its previous value.