https://stackoverflow.com/questions/10029588/python-implemen...
The accepted answer uses a hard-coded z-value.
In the event that you want a dynamic z-value like the ruby solution offers, I just submitted the following solution: