I think a few notes and examples can help you.
- "Return 0" - it is error! Pam uses her own variables. Next code for example https://github.com/Ralnoc/pam-python/blob/master/examples/pam_deny.py
- Send message. Show example for it https://pam-python.sourceforge.net/examples/pam_nologin.py
- Selecting the verification stage.Have you selected the "auth requisite" verification stage correctly? Our actions can be performed at 4 stages: account,auth,password,session
login account requisite pam_python.so pam_accept.py
login auth requisite pam_python.so pam_accept.py
login password requisite pam_python.so pam_accept.py
login session requisite pam_python.so pam_accept.py