parameters: (fun)
return_statement: return wrapper
docstring: Decorator which translates bare OSError exceptions into
      NoSuchProcess and AccessDenied.
docstring_summary: Decorator which translates bare OSError exceptions into
      NoSuchProcess and AccessDenied.
docstring_tokens: Decorator which translates bare OSError exceptions into NoSuchProcess and AccessDenied .
function: def wrap_exceptions(fun):
      """Decorator which translates bare OSError exceptions into
      NoSuchProcess and AccessDenied.
      """
      @wraps(fun)
      def wrapper(self, *args, **kwargs):
          try:
              return fun(self, *args, **kwargs)
          except OSError:
              err = sys.exc_info()[1]
              if err.errno == errno.ESRCH:
                  raise NoSuchProcess(self.pid, self._process_name)
              if err.errno in (errno.EPERM, errno.EACCES):
                  raise AccessDenied(self.pid, self._process_name)
              raise
      return wrapper
function_tokens: def wrap_exceptions ( fun ) : @ wraps ( fun ) def wrapper ( self , * args , * * kwargs ) : try : return fun ( self , * args , * * kwargs ) except OSError : err = sys . exc_info ( ) [ 1 ] if err . errno == errno . ESRCH : raise NoSuchProcess ( self . pid , self . _process_name ) if err . errno in ( errno . EPERM , errno . EACCES ) : raise AccessDenied ( self . pid , self . _process_name ) raise return wrapper