imt.from_string now returns a ValueError and can be used as a validator

This is helpful for the new validation system. See the companion https://github.com/gem/oq-commonlib/pull/31.
The tests run: https://ci.openquake.org/job/zdevel_oq-hazardlib/92