Where does the `encoding` dict come from? Assuming this should check the encoding of `my_msg`, why would `my_msg` not be 'ascii', after it's encoded as such?
If the encoding failed, it would raise an Exception and not get here.
`part1` is never used.