Allow YAML serialization when using TZ aware attributes

Fixes #16883