That was in katello https://github.com/Katello/katello/blob/9448155494d1c33a99ab2a38c151c6de6b31afaf/app/lib/api/mapper_extensions.rb#L6
I consider it safer to use a helper.