code: def open(self):
          ''' Open file corresponding to the TUN device. '''
          self.fd = open('/dev/net/tun', 'rb+', buffering=0)
          tun_flags = IFF_TAP | IFF_NO_PI | IFF_PERSIST
          ifr = struct.pack('16sH', self.name, tun_flags)
          fcntl.ioctl(self.fd, TUNSETIFF, ifr)
          fcntl.ioctl(self.fd, TUNSETOWNER, os.getuid())
          self.ifflags = self.ifflags | IFF_RUNNINf open(self):
          ''' Open file corresponding to the TUN device. '''
          self.fd = open('/dev/net/tun', 'rb+', buffering=0)
          tun_flags = IFF_TAP | IFF_NO_PI | IFF_PERSIST
          ifr = struct.pack('16sH', self.name, tun_flags)
          fcntl.ioctl(self.fd, TUNSETIFF, ifr)
          fcntl.ioctl(self.fd, TUNSETOWNER, os.getuid())
          self.ifflags = self.ifflags | IFF_RUNNING
docs: Open file corresponding to the TUN device.