Moved get_realizations from the engine into commonlib

See https://bugs.launchpad.net/oq-engine/+bug/1394894.
The tests are green: https://ci.openquake.org/job/master_oq-risklib/120
A doctest would help the reader