Fixed _format_key failure to sha1 unicode string in python3