code: def get_iface_mode(iface):
      
      p = subprocess.Popen(["iwconfig", iface], stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT)
      output, err = p.communicate()
      match = re.search(br"mode:([a-zA-Z]*)", output.lower())
      if match:
          return plain_str(match.group(1))
      return "unknown"
docs: Return the interface mode.
      params:
       - iface: the iwconfig interface