if isinstance(data, dict):
    return dict(map(convert, list(data.items())))
if isinstance(data, tuple):
    return map(convert, data)
return data
Fastest way to convert a dict's keys & values from `bytes` to `str` in python3