human
Complete this python program:
def get_user_scope(module_context, position):
assistant
#Here is the Python program you requested.

    """Returns the scope in which the user resides. This includes flows.
    """
    user_stmt = get_statement_of_position(module_context.tree_node, position)
    if (user_stmt is None):
        def scan(scope):
            for s in scope.children:
                if (s.start_pos <= position <= s.end_pos):
                    if isinstance(s, (tree.Scope, tree.Flow)):
                        return (scan(s) or s)
                    elif (s.type in ('suite', 'decorated')):
                        return scan(s)
            return None
        scanned_node = scan(module_context.tree_node)
        if scanned_node:
            return module_context.create_context(scanned_node, node_is_context=True)
        return module_context
    else:
        return module_context.create_context(user_stmt)