First, put the script to a common location e.g. /usr/local/bin/vm-post.py
Then, point your Asterisk mail command to this script to invoke it when a voice mail is received.
The script will decode the text message (as configured from Asterisk) and the voice message (stored with wav encoding).