1>>> import ast
2>>> ast.literal_eval("{'muffin' : 'lolz', 'foo' : 'kitty'}")
3{'muffin': 'lolz', 'foo': 'kitty'}
1# python3
2import ast
3byte_str = b"{'one': 1, 'two': 2}"
4dict_str = byte_str.decode("UTF-8")
5mydata = ast.literal_eval(dict_str)
6print(repr(mydata))