code: def close(self, code=3000, reason="Go away!"):
          
          if self.state in (STATE_CLOSING, STATE_CLOSED):
              return
  
          if self._debug:
              log.debug("close session: %s", self.id)
  
          self.state = STATE_CLOSING
          self._feed(FRAME_CLOSE, (code, reason))
docs: close session