def replace_kv(self, _dict):
    """Replace any occurrence of a value with the key"""
for key, value in _dict.items():
    label = '[[ {0} ]]'.format(key)
self.text = self.text.replace(value, label)
return self.text

def iterate(self, lod):
    """Iterate over each dict object in a given list of dicts, `lod` """
for _dict in lod:
    self.text = self.replace_kv(_dict)
return self.text
Running replace() method in a for loop?