code: def _get_socket(self, sid):
          
          try:
              s = self.sockets[sid]
          except KeyError:
              raise KeyError('Session not found')
          if s.closed:
              del self.sockets[sid]
              raise KeyError('Session is disconnected')
          return s
docs: Return the socket object for a given session.