def METHOD_NAME(self, tag, attrs):
    """Delete all other tags except for those specified in valid_tags"""
    if tag in self.valid_tags:       
        self._write(["<", tag])
        for k, v in attrs:
            if k in self.valid_attrs:
                self._write([" ", k, "=\"", v, "\""])
        self._write(">")