Edited version for Python in Processing