'Filter system messages from a doctree.'

def filter_messages(self, doctree):

    filterlevel = ((self.config.keep_warnings and 2) or 5)
    for node in doctree.traverse(nodes.system_message):
        if (node['level'] < filterlevel):
            node.parent.remove(node)
