parameters: (module_context, position)
docstring: Returns the scope in which the user resides. This includes flows.
docstring_summary: Returns the scope in which the user resides. This includes flows.
docstring_tokens: Returns the scope in which the user resides . This includes flows .
function: def get_user_scope(module_context, position):
      """
      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)
function_tokens: def get_user_scope ( module_context , position ) : 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 )