code: def add_device_net(self, name, destname=None):
          
  
          if not self.running:
              return False
  
          if os.path.exists("/sys/class/net/%s/phy80211/name" % name):
              with open("/sys/class/net/%s/phy80211/name" % name) as fd:
                  phy = fd.read().strip()
  
              if subprocess.call(['iw', 'phy', phy, 'set', 'netns',
                                  str(self.init_pid)]) != 0:
                  return False
  
              if destname:
                  def rename_interface(args):
                      old, new = args
  
                      return subprocess.call(['ip', 'link', 'set',
                                              'dev', old, 'name', new])
  
                  return self.attach_wait(rename_interface, (name, destname),
                                          namespaces=(CLONE_NEWNET)) == 0
  
              return True
  
          if not destname:
              destname = name
  
          if not os.path.exists("/sys/class/net/%s/" % name):
              return False
  
          return subprocess.call(['ip', 'link', 'set',
                                  'dev', name,
                                  'netns', str(self.init_pid),
                                  'name', destname]) == 0
docs: Add network device to running container.