Return the node before this node.

def get_previous_node(node):
    """
    Return the node before this node.
    """
    if node.prev_sibling:
        return node.prev_sibling
    if node.parent:
        return get_previous_node(node.parent)