'Return the encryption type of the access point
:param self: An AccessPointFinder object
:param packet: A scapy.layers.RadioTap object
:type self: AccessPointFinder
:type packet: scapy.layers.RadioTap
:return: encryption type of the access point
:rtype: string
.. note: Possible return values are WPA2, WPA, WEP and OPEN'

def _find_encryption_type(self, packet):

    encryption_info = packet.sprintf('%Dot11Beacon.cap%')
    elt_section = packet[dot11.Dot11Elt]
    encryption_type = None
    while isinstance(elt_section, dot11.Dot11Elt):
        if (elt_section.ID == 48):
            encryption_type = 'WPA2'
            break
        elif ((elt_section.ID == 221) and elt_section.info.startswith('\x00P\xf2\x01\x01\x00')):
            encryption_type = 'WPA'
            break
        elt_section = elt_section.payload
    if (not encryption_type):
        if ('privacy' in encryption_info):
            encryption_type = 'WEP'
        else:
            encryption_type = 'OPEN'
    return encryption_type
