<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def document_order(node):
 """Compute a document order value for the node. cmp(document_order(a), document_order(b)) will return -1, 0, or 1 if a is before, identical to, or after b in the document respectively. We represent document order as a list of sibling indexes. That is, the third child of the document node has an order of [2]. The first child of that node has an order of [2,0]. Attributes have a sibling index of -1 (coming before all children of their node) and are further ordered by name--e.g., [2,0,-1,'href']. """


    # Attributes: parent-order + [-1, attribute-name]
    if node.nodeType == node.ATTRIBUTE_NODE:
        order = document_order(node.ownerElement)
        order.extend((-1, node.name))
        return order

    # The document root (hopefully): []
    if node.parentNode is None:
        return []

    # Determine which child this is of its parent.
    sibpos = 0
    sib = node
    while sib.previousSibling is not None:
        sibpos += 1
        sib = sib.previousSibling

    # Order: parent-order + [sibling-position]
    order = document_order(node.parentNode)
    order.append(sibpos)
    return order