Should this be `return value.encode('utf-8')` instead, in case the value contains non-ASCII chars?