def purify(self, best_elem):
        del best_elem['class']
        del best_elem['id']
        g = best_elem.recursiveChildGenerator()
        while True:
            try:
                tag = g.next()
                if tag is None:
                    break
                #text node
                if not isinstance(tag,unicode) and tag is not None:
                    if tag.name == 'a':
                        tag.unwrap()
                    elif tag.name == 'img':
                        img_src = tag.get('src')
                        data_src = tag.get('data-src')
                        if img_src is None and data_src is None:
                            tag.extract()
                        else:
                            if data_src is not None:
                                if data_src.startswith("http"):
                                    img_src = data_src
                                else:
                                    img_src = self.domain + data_src
                            else:
                                if not img_src.startswith("http"):
                                    img_src = self.domain + img_src
                        attr_names = [attr for attr in tag.attrs]
                        for attr in attr_names:
                            del tag[attr]
                        tag['src'] = img_src
                    del tag['class']
                    del tag['id']
                    continue
            except StopIteration:
                break
        return best_elem.prettify("utf-8")