code: def attach(decorator, obj, recursive=True):
      
      if inspect.ismodule(obj):
          for name, fn in inspect.getmembers(obj, inspect.isfunction):
              setattr(obj, name, decorator(fn))
          for name, klass in inspect.getmembers(obj, inspect.isclass):
              attach_to_class(decorator, klass, recursive)
      elif inspect.isclass(obj):
          attach_to_class(decorator, obj, recursive)
docs: attach(decorator, class_or_module[, recursive = True])
  
      Utility to attach a \val{decorator} to the \val{obj} instance.
  
      If \val{obj} is a module, the decorator will be attached to every
      function and class in the module.
  
      If \val{obj} is a class, the decorator will be attached to every
      method and subclass of the class.
  
      if \val{recursive} is "True" then subclasses will be decorated.