text = "Тестовая строка" # Unicode в Python 3.x
assert type(text) is str
octetstring1 = bytes(text, encoding='utf-8')
assert type(octetstring1) is bytes
octetstring2 = text.encode('utf-8')
assert type(octetstring1) is bytes
assert octetstring1 == octetstring2
text = octetstring2.decode('utf-8')
assert type(text) is str