code: def getFlags (self, ifname):
          
          try:
              result = self._ioctl(self.SIOCGIFFLAGS, self._getifreq(ifname))
          except IOError as msg:
              log.warn(LOG_CHECK,
                   "error getting flags for interface %r: %s", ifname, msg)
              return 0
          # extract the interface's flags from the return value
          flags, = struct.unpack('H', result[16:18])
          # return "UP" bit
          return flags
docs: Get the flags for an interface