How to test SNMP credentials using python

Edit node gives us an option to test the node against the credentials in the Orion.

I wanted to know is there any way to test it using python code.

My intention is to verify if the test is successful when a new node is added into orion using python rest api.

Thanks in advance