docs: def delayed_close(closable):
      """Delay close until this contextmanager dies"""
  
      close = getattr(closable, "close", None)
      if close:
          # we do not want the library to close file in case we need to
          # resume, hence make close a no-op
          # pylint: disable=unused-argument
          def replacement_close(*args, **kw):
              """ No op """
              pass
  
          # pylint: enable=unused-argument
          setattr(closable, "close", replacement_close)
      try:
          yield closable
      finally:
          if close:
              setattr(closable, "close", close)
              closable.close()