Connect Disconnect to wifi network using script

I wanted to develop a test script so that base on user input in the PC I can connect or disconnect from the given wifi connection. How can I do the same using appium and python