New python api

Updated python examples to use the new Python API.