def get_document_unicode(document):
try:<EOL><INDENT>return document.__unicode__()<EOL><DEDENT>except AttributeError:<EOL><INDENT>return six.text_type(document)<EOL><DEDENT>
Safely converts MongoDB document strings to unicode.