'Remove recursive references to allow garbage
collector to collect this object.'

def cleanup(self):

    for dict in (self.rule2func, self.rules, self.rule2name):
        for i in dict.keys():
            dict[i] = None
    for i in dir(self):
        setattr(self, i, None)
