Run a Script when Power Button is Pushed
How about just placing your script in run level 6 as mentioned and detailed here:
How to run a command before the machine automatically shutdowns?
Place your python script in /etc/acpi/ and then add the following two lines to the top of /etc/acpi/powerbtn.sh
sudo python your_python_script.py
exit 0