def parallel(function):
   """
   Decorator to turn a method into a pseudo_thread.

   The method itself should be written:
   
   def (th, self, *args, **kwds):
      
   Use th.call to call another method which is a pseudo thread.
   Use th.Return to return a value to the caller.
   Use th.start 

   self is the reference to the inclosing instance.
   """
   class p(method_pseudo_threads):
      name = "parallel_class_" + function.func_name
   p.func = function
   def glue(self, caller, *args, **kwds):
      thread = p(caller, self, *args, **kwds)
      yield (None, thread)
   glue._parallel = True
   glue.func_name = "parallel_" + function.func_name
   return glue

   Decorator to turn a method into a pseudo_thread.

   The method itself should be written:
   
   def (th, self, *args, **kwds):
      
   Use th.call to call another method which is a pseudo thread.
   Use th.Return to return a value to the caller.
   Use th.start 

   self is the reference to the inclosing instance.
   
recipes/Python/474127_Simulating_concurrency/recipe-474127.py