Fix crash in py3: 'TypeError: a bytes-like object is required, not 'str' (#37504)
Fix crash in py3: 'TypeError: a bytes-like object is required, not 'str' (#37504)

* Fix crash in py3: 'TypeError: a bytes-like object is required, not 'str'

Fixes #37387

* Review applied https://github.com/ansible/ansible/pull/37504#pullrequestreview-104799823

thaim/ansible,thaim/ansible