14 lines
373 B
Python
14 lines
373 B
Python
|
def convert(data):
|
||
|
"""
|
||
|
Recursively convert a dictionary.
|
||
|
"""
|
||
|
if isinstance(data, bytes):
|
||
|
return data.decode("ascii")
|
||
|
if isinstance(data, dict):
|
||
|
return dict(map(convert, data.items()))
|
||
|
if isinstance(data, tuple):
|
||
|
return map(convert, data)
|
||
|
if isinstance(data, list):
|
||
|
return list(map(convert, data))
|
||
|
return data
|