We need to convert a dictionary where keys and values
    are bytes, to unicode strings.  This happens when a
    Python 2 worker sends a dictionary back to a Python 3 master.

def decode(data, encoding='utf-8', errors='strict'):
    """We need to convert a dictionary where keys and values
    are bytes, to unicode strings.  This happens when a
    Python 2 worker sends a dictionary back to a Python 3 master.
    """
    data_type = type(data)

    if data_type == bytes:
        return bytes2unicode(data, encoding, errors)
    if data_type in (dict, list, tuple):
        if data_type == dict:
            data = data.items()
        return data_type(map(decode, data))
    return data