code: def _wifi_connect():
      
      if not wlan.isconnected():
          wlan.active(True)
          print("NETWORK: connecting to network %s..." % settings.WIFI_SSID)
          wlan.connect(settings.WIFI_SSID, secret)
          while not wlan.isconnected():
              print("NETWORK: waiting for connection...")
              utime.sleep(1)
          print("NETWORK: Connected, network config: %s" % repr(wlan.ifconfig()))
docs: Connects to WIFI