code: def _remove_os_link():
          
  
          class NoValue:
              pass
  
          orig_val = getattr(os, 'link', NoValue)
          try:
              del os.link
          except Exception:
              pass
          try:
              yield
          finally:
              if orig_val is not NoValue:
                  setattr(os, 'link', orig_val)
docs: In a context, remove and restore os.link if it exists