code: def _register_socket(s):
          '''
          Internal method used by socket emulation layer to create a new "upward"
          queue for an app-layer socket and to register the socket object.
          Returns two queues: "downward" (fromapp) and "upward" (toapp).
          '''
          queue_to_app = Queue()
          with _lock:
              ApplicationLayer._to_app[s._sockid()] = queue_to_app
          return ApplicationLayer._from_app, queue_to_apf _register_socket(s):
          '''
          Internal method used by socket emulation layer to create a new "upward"
          queue for an app-layer socket and to register the socket object.
          Returns two queues: "downward" (fromapp) and "upward" (toapp).
          '''
          queue_to_app = Queue()
          with _lock:
              ApplicationLayer._to_app[s._sockid()] = queue_to_app
          return ApplicationLayer._from_app, queue_to_app
docs: Internal method used by socket emulation layer to create a new "upward"
          queue for an app-layer socket and to register the socket object.
          Returns two queues: "downward" (fromapp) and "upward" (toapp).