Python: Refactor Optimization classes and add Dataset abstraction

Some updates to the current python bindings.