def convert_bytes_to_str(data, encoding="utf-8"):
    """Convert a dict's keys & values from `bytes` to `str`
    or convert bytes to str"""
    if isinstance(data, bytes):
        return data.decode(encoding)
    if isinstance(data, dict):
        return dict(map(convert_bytes_to_str, data.items()))
    elif isinstance(data, tuple):
        return map(convert_bytes_to_str, data)
    return data
Convert a dict's keys & values from `bytes` to `str`
    or convert bytes to str
src/scrapy_redis/utils.py