Simplify shared_ptr extraction from Python object

Also avoid using the raw Python C API in favour of the boost python wrappers to
ensure that the reference counting is dealt with properly
Refs #9513
Merge branch 'bugfix/9513_pyobj_del_not_called' into develop