docs: def get_rsn_ie(defcipher, defauth, data):
      """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n441.
  
      Positional arguments:
      defcipher -- default cipher if not in data (string).
      defauth -- default authentication suites if not in data (string).
      data -- bytearray data to read.
  
      Returns:
      Dict.
      """
      answers = dict()
      answers['version'] = data[0] + (data[1] << 8)
      data = data[2:]
  
      if len(data) < 4:
          answers['group_cipher'] = answers['pairwise_ciphers'] = defcipher
          return answers
      answers['group_cipher'] = get_cipher(data)
      data = data[4:]
      if len(data) < 2:
          answers['pairwise_ciphers'] = defcipher
          return answers
  
      count = data[0] | (data[1] << 8)
      if 2 + (count * 4) > len(data):
          answers['bogus tail data'] = data
          return answers
      answers['pairwise_ciphers'] = ' '.join(get_cipher(data[2 + (i * 4):]) for i in range(count))
      data = data[2 + (count * 4):]
  
      if len(data) < 2:
          answers['authentication_suites'] = defauth
          return answers
      count = data[0] | (data[1] << 8)
      if 2 + (count * 4) > len(data):
          answers['bogus tail data'] = data
          return answers
      answers['authentication_suites'] = ' '.join(get_auth(data[2 + (i * 4):]) for i in range(count))
      data = data[2 + (count * 4):]
  
      if len(data) >= 2:
          capa = data[0] | (data[1] << 8)
          answers['rsn_ie_capabilities'] = list()
          if capa & 0x0001:
              answers['rsn_ie_capabilities'].append('PreAuth')
          if capa & 0x0002:
              answers['rsn_ie_capabilities'].append('NoPairwise')
          case = {0: '1-PTKSA-RC', 1: '2-PTKSA-RC', 2: '4-PTKSA-RC', 3: '16-PTKSA-RC'}.get((capa & 0x000c) >> 2)
          if case:
              answers['rsn_ie_capabilities'].append(case)
          case = {0: '1-GTKSA-RC', 1: '2-GTKSA-RC', 2: '4-GTKSA-RC', 3: '16-GTKSA-RC'}.get((capa & 0x0030) >> 4)
          if case:
              answers['rsn_ie_capabilities'].append(case)
          if capa & 0x0040:
              answers['rsn_ie_capabilities'].append('MFP-required')
          if capa & 0x0080:
              answers['rsn_ie_capabilities'].append('MFP-capable')
          if capa & 0x0200:
              answers['rsn_ie_capabilities'].append('Peerkey-enabled')
          if capa & 0x0400:
              answers['rsn_ie_capabilities'].append('SPP-AMSDU-capable')
          if capa & 0x0800:
              answers['rsn_ie_capabilities'].append('SPP-AMSDU-required')
          answers['rsn_ie_capabilities'].append('(0x{0:04x})'.format(capa))
          data = data[2:]
  
      invalid = False
      if len(data) >= 2:
          pmkid_count = data[0] | (data[1] << 8)
          if len(data) >= 2 + 16 * pmkid_count:
              answers['PMKIDs'] = pmkid_count
              data = data[2 + 16 * pmkid_count:]
          else:
              invalid = True
  
      if len(data) >= 4 and not invalid:
          answers['Group mgmt cipher suite'] = get_cipher(data)
          data = data[4:]
  
      if data:
          answers['* bogus tail data ({0})'.format(len(data))] = ' '.join(format(x, '02x') for x in data)
  
      return answers