

def pass_through_all_values(self, pattern, function, data):
    if isinstance(data, dict):
        new_dict = {
            
        }
        for (key, value) in data.items():
            new_key = re.sub(pattern, function, key)
            new_dict[new_key] = self.pass_through_all_values(pattern, function, value)
        return new_dict
    if isinstance(data, (list, tuple)):
        for i in range(len(data)):
            data[i] = self.pass_through_all_values(pattern, function, data[i])
        return data
    return data

dataset/ETHPy150Open globocom/tapioca/tapioca/serializers.py JsonEncoder.pass_through_all_values/original