I would like to write the following code:

import string
frm = b'acdefhnoprstuw'
to  = 'אקדיפהנופרסתאו'
trans_table = string.maketrans(frm, to)
hebrew_phrase = 'fear cuts deeper than swords'.translate(trans_table)

The above code doesn't work because the to parameter to string.maketrans(frm, to) has to be a byte sequence, not a string. The problem is that byte sequences can only contain ASCII literal characters. Therefore I cannot make a transformation which translates English strings to Hebrew strings. The reason is that string.maketrans() retruns a bytes object.

Is there an elegant way to use the string.maketrans() and translate() functions (or equivalent functions that work with unicode) for my task?

Edit
Report