I think it's the right way. The get_ensemble_id checks the id against the regular expression and throws an exception if it doesn't fit.