How is Python used for network automation?