Python api

This is basically a clone of the new node.js api but for python.