http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n1456.

    Positional arguments:
    ie -- bytearray data to read.

    Returns:
    Dictionary of all parsed data. In the iw tool it prints everything to terminal. This function returns a dictionary
    with string keys (being the "titles" of data printed by iw), and data values (integers/strings/etc).

def get_ies(ie):
    """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n1456.

    Positional arguments:
    ie -- bytearray data to read.

    Returns:
    Dictionary of all parsed data. In the iw tool it prints everything to terminal. This function returns a dictionary
    with string keys (being the "titles" of data printed by iw), and data values (integers/strings/etc).
    """
    answers = dict()
    while len(ie) >= 2 and len(ie) >= ie[1]:
        key = ie[0]  # Should be key in `ieprinters` dict.
        len_ = ie[1]  # Length of this information element.
        data = ie[2:len_ + 2]  # Data for this information element.
        if key in ieprinters and ieprinters[key].flags & 1:
            answers.update(get_ie(ieprinters[key], key, data))
        elif key == 221:
            answers.update(get_vendor(data))
        else:
            answers['Unknown IE ({0})'.format(key)] = ' '.join(format(x, '02x') for x in data)
        ie = ie[len_ + 2:]
    return answers