Moved the logic tree realizations into commonlib

See https://bugs.launchpad.net/oq-engine/+bug/1394894 and the companion PR https://github.com/gem/oq-risklib/pull/86
The tests are running here: https://ci.openquake.org/job/zdevel_oq-engine/897