First attempt at modularizing the SWIG interface. To do: make this a proper Python package.