@contextmanager
def swallow_psutil_exceptions():
 try:
  (yield)
 except (psutil.AccessDenied, psutil.NoSuchProcess):
  pass

@ contextmanager def swallow_psutil_exceptions ( ) : try : ( yield ) except ( psutil . AccessDenied , psutil . NoSuchProcess ) : pass
a contextmanager that swallows standard psutil access exceptions .