def find_wifi_shield(self, shield_name=None, wifi_shield_cb=None):
    'Detects Ganglion board MAC address -- if more than 1 around, will select first. Needs root privilege.'
    if self.log:
        print('Try to find WiFi shields on your local wireless network')
        print(('Scanning for %d seconds nearby devices...' % self.timeout))
    list_ip = []
    list_id = []
    found_shield = False

    def wifi_shield_found(response):
        res = requests.get(response.location, verify=False).text
        device_description = xmltodict.parse(res)
        cur_shield_name = str(device_description['root']['device']['serialNumber'])
        cur_base_url = str(device_description['root']['URLBase'])
        cur_ip_address = re.findall('[0-9]+(?:\\.[0-9]+){3}', cur_base_url)[0]
        list_id.append(cur_shield_name)
        list_ip.append(cur_ip_address)
        found_shield = True
        if (shield_name is None):
            print(('Found WiFi Shield %s with IP Address %s' % (cur_shield_name, cur_ip_address)))
            if (wifi_shield_cb is not None):
                wifi_shield_cb(cur_ip_address)
        elif (shield_name == cur_shield_name):
            if (wifi_shield_cb is not None):
                wifi_shield_cb(cur_ip_address)
    ssdp_hits = ssdp.discover('urn:schemas-upnp-org:device:Basic:1', timeout=self.timeout, wifi_found_cb=wifi_shield_found)
    nb_wifi_shields = len(list_id)
    if (nb_wifi_shields < 1):
        print('No WiFi Shields found ;(')
        raise OSError('Cannot find OpenBCI WiFi Shield with local name')
    if (nb_wifi_shields > 1):
        print(((((('Found ' + str(nb_wifi_shields)) + ', selecting first named: ') + list_id[0]) + ' with IPV4: ') + list_ip[0]))
        return list_ip[0]
Detects Ganglion board MAC address -- if more than 1 around, will select first. Needs root privilege.
def find_wifi_shield(self, shield_name=None, wifi_shield_cb=None):
    
    if self.log:
        print('Try to find WiFi shields on your local wireless network')
        print(('Scanning for %d seconds nearby devices...' % self.timeout))
    list_ip = []
    list_id = []
    found_shield = False

    def wifi_shield_found(response):
        res = requests.get(response.location, verify=False).text
        device_description = xmltodict.parse(res)
        cur_shield_name = str(device_description['root']['device']['serialNumber'])
        cur_base_url = str(device_description['root']['URLBase'])
        cur_ip_address = re.findall('[0-9]+(?:\\.[0-9]+){3}', cur_base_url)[0]
        list_id.append(cur_shield_name)
        list_ip.append(cur_ip_address)
        found_shield = True
        if (shield_name is None):
            print(('Found WiFi Shield %s with IP Address %s' % (cur_shield_name, cur_ip_address)))
            if (wifi_shield_cb is not None):
                wifi_shield_cb(cur_ip_address)
        elif (shield_name == cur_shield_name):
            if (wifi_shield_cb is not None):
                wifi_shield_cb(cur_ip_address)
    ssdp_hits = ssdp.discover('urn:schemas-upnp-org:device:Basic:1', timeout=self.timeout, wifi_found_cb=wifi_shield_found)
    nb_wifi_shields = len(list_id)
    if (nb_wifi_shields < 1):
        print('No WiFi Shields found ;(')
        raise OSError('Cannot find OpenBCI WiFi Shield with local name')
    if (nb_wifi_shields > 1):
        print(((((('Found ' + str(nb_wifi_shields)) + ', selecting first named: ') + list_id[0]) + ' with IPV4: ') + list_ip[0]))
        return list_ip[0]