code: def is_interface_up(interface):
      
  
      if sys.platform.startswith("linux"):
  
          if interface not in psutil.net_if_addrs():
              return False
  
          import fcntl
          SIOCGIFFLAGS = 0x8913
          try:
              with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
                  result = fcntl.ioctl(s.fileno(), SIOCGIFFLAGS, interface + '\0' * 256)
                  flags, = struct.unpack('H', result[16:18])
                  if flags & 1:  # check if the up bit is set
                      return True
              return False
          except OSError as e:
              raise aiohttp.web.HTTPInternalServerError(text="Exception when checking if {} is up: {}".format(interface, e))
      else:
          # TODO: Windows & OSX support
          return True
docs: Checks if an interface is up.
  
      :param interface: interface name
  
      :returns: boolean