def do_connect():
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print("Connecting")
sta_if.active(True)
sta_if.connect(WLAN_NAME, WLAN_PASS)
while not sta_if.isconnected():
pass