def is_doctype(self): ''' Check if this element is a doctype ''' return isinstance(self.context, Doctype)