put the results in a list, join the list elements in a string separated by whitespace separator, return the string as the bytes string. evaluate the method six.text_type(s), on the result call the method encode with the arguments encoding and errors, return the result.
return six . text_type ( s ) . encode ( encoding , errors )