If this was handled in a preprocessing step instead, it would make the .yaml files much easier to both write and read for humans.
The preprocessing function could also automatically check that that the .yaml file is correctly constructed and raise an error if not.