<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def traversal(graph, node, order):
 """ Graph traversal iterator. @type graph: graph, digraph @param graph: Graph. @type node: node @param node: Node. @type order: string @param order: traversal ordering. Possible values are: 2. 'pre' - Preordering (default) 1. 'post' - Postordering @rtype: iterator @return: Traversal iterator. """

    visited = {}
    if (order == 'pre'):
        pre = 1
        post = 0
    elif (order == 'post'):
        pre = 0
        post = 1
    
    for each in _dfs(graph, visited, node, pre, post):
        yield each