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

    Positional arguments:
    cap -- c_uint16

    Returns:
    List.

def get_ht_capability(cap):
    """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/util.c?id=v3.17#n541.

    Positional arguments:
    cap -- c_uint16

    Returns:
    List.
    """
    answers = list()
    if cap & 1:
        answers.append('RX LDPC')
    if cap & 2:
        answers.append('HT20/HT40')
    if not cap & 2:
        answers.append('HT20')
    if (cap >> 2) & 0x3 == 0:
        answers.append('Static SM Power Save')
    if (cap >> 2) & 0x3 == 1:
        answers.append('Dynamic SM Power Save')
    if (cap >> 2) & 0x3 == 3:
        answers.append('SM Power Save disabled')
    if cap & 16:
        answers.append('RX Greenfield')
    if cap & 32:
        answers.append('RX HT20 SGI')
    if cap & 64:
        answers.append('RX HT40 SGI')
    if cap & 128:
        answers.append('TX STBC')
    if (cap >> 8) & 0x3 == 0:
        answers.append('No RX STBC')
    if (cap >> 8) & 0x3 == 1:
        answers.append('RX STBC 1-stream')
    if (cap >> 8) & 0x3 == 2:
        answers.append('RX STBC 2-streams')
    if (cap >> 8) & 0x3 == 3:
        answers.append('RX STBC 3-streams')
    if cap & 1024:
        answers.append('HT Delayed Block Ack')
    if not cap & 2048:
        answers.append('Max AMSDU length: 3839 bytes')
    if cap & 2048:
        answers.append('Max AMSDU length: 7935 bytes')
    if cap & 4096:
        answers.append('DSSS/CCK HT40')
    if not cap & 4096:
        answers.append('No DSSS/CCK HT40')
    if cap & 16384:
        answers.append('40 MHz Intolerant')
    if cap & 32768:
        answers.append('L-SIG TXOP protection')
    return answers