def _remove_xml(xast, node, context, if_empty=False):
if isinstance(xast, ast.Step):<EOL><INDENT>if isinstance(xast.node_test, ast.NameTest):<EOL><INDENT>if xast.axis in (None, '<STR_LIT>'):<EOL><INDENT>return _remove_child_node(node, context, xast, if_empty=if_empty)<EOL><DEDENT>elif xast.axis in ('<STR_LIT:@>', '<STR_LIT>'):<EOL><INDENT>return _remove_attribute_node(node, context, xast)<EOL><DEDENT><DEDENT>elif _is_text_nodetest(xast):<EOL><INDENT>node.text = '<STR_LIT>'<EOL>return True<EOL><DEDENT><DEDENT>elif isinstance(xast, ast.BinaryExpression):<EOL><INDENT>if xast.op == '<STR_LIT:/>':<EOL><INDENT>left_xpath = serialize(xast.left)<EOL>left_node = _find_xml_node(left_xpath, node, context)<EOL>if left_node is not None:<EOL><INDENT>removed = _remove_xml(xast.right, left_node, context,<EOL>if_empty=if_empty) <EOL>if removed and _predicate_is_constructible(left_xpath):<EOL><INDENT>_remove_xml(xast.left, node, context, if_empty=True)<EOL><DEDENT>return removed<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Remove a node or attribute.  For multipart XPaths that are
    constructible by :mod:`eulxml.xmlmap`, the corresponding nodes
    will be removed if they are empty (other than predicates specified
    in the XPath).

    :param xast: parsed xpath (xpath abstract syntax tree) from
        :mod:`eulxml.xpath`
    :param node: lxml node relative to which xast should be removed
    :param context: any context required for the xpath (e.g.,
        namespace definitions)
    :param if_empty: optional boolean; only remove a node if it is
        empty (no attributes and no child nodes); defaults to False

    :returns: True if something was deleted