It looks like you are also using PyYAML, which only supports a subset of YAML 1.1, and ruamel.yaml dumps by default to YAML 1.2. So I would expect you to use y.version = (1, 1) or similar to force YAML 1.1 output.
It would also be useful if you include the actual value of s