See
str.encode
.