Added a function for BPYTHON that I found here: http://stackoverflow.com/a/22182421