'Encode any bytes in a dict, noting the index of what is encoded.'

def _encode_dict(self, data, path):

    new_data = {}
    encoded = []
    for (key, value) in data.items():
        new_path = (path + [key])
        (new_value, new_encoded) = self._encode(value, new_path)
        new_data[key] = new_value
        encoded.extend(new_encoded)
    return (new_data, encoded)
