Add a facility to read source models in commonlib

See https://bugs.launchpad.net/oq-engine/+bug/1390348.
This also fixes https://bugs.launchpad.net/oq-engine/+bug/1267424.
The tests are green: https://ci.openquake.org/job/zdevel_oq-commonlib/185
I have some doubts about this condition. `enough_sources` is true if, before filtering by distance, there were sources. Are we still considering that, or if, after the filter, we have at least one source?