code: def device(self, s1_mode, s2_mode):
      self.s1_mode = s1_mode
      self.s2_mode = s2_mode
  
      device = NanomsgDevice(
          self,
          s1_mode,
          s2_mode,
          default_addr=NanomsgContext.default_addr,
      )
      in_port, out_port = device.bind()
  
      backend = get_backend()
      ip_ext, _, _ = backend.get_listen_addr()
  
      in_addr = "tcp://{}:{}".format(ip_ext, in_port)
      out_addr = "tcp://{}:{}".format(ip_ext, out_port)
  
      return device, in_addr, out_addr
  
imports: import random
  import logging
  import multiprocessing
  import threading
  from fiber.backend import get_backend
label_desc: Use image node_id 5 for calling the NanomsgContext obj's underlying member method code with example usage: obj.device(s1_mode, s2_mode) and returns: device,  in_addr,  out_addr