code: def close(self):
          
          if self._S is not None:
              # after .close() self._event should never be called
              self._S.close()
              # wait for Cancelled to be delivered
              self._evt.wait()
              self._S = None
docs: Close subscription.