class_docstr: A floder to fold a graph' nodes which has same scope into one node.
class_docstr_tok: ["A","floder","to","fold","a","graph","'","nodes","which","has","same","scope","into","one","node","."]
code: def _get_scope_name_dict(
      self,
      node_list,
      top_level=0,
      top_scope=None,
      sub_level=2,
      sub_scope=None,
  ):
      scope_node_names = collections.OrderedDict()
  
      def _insert_scope_node_names_dict(scope_no, node_name):
          if scope_node_names.get(scope_no, None):
              scope_node_names[scope_no].append(node_name)
          else:
              scope_node_names[scope_no] = list([node_name])
  
      def _get_scope_name_dict_by_cond(cond_top, cond_sub):
          for node_name in node_list:
              node = self._graph.get_node(node_name)
              if not node.get_attr("scope"):
                  continue
              node_scope = node.get_attr("scope")
              if cond_top(top_scope, node_scope) and cond_sub(
                  sub_scope, node_scope
              ):
                  if (
                      "True" in cond_top.__name__
                      and "True" not in cond_sub.__name__
                  ):
                      scope_no = node_scope.split("/")[sub_level]
                  elif (
                      "True" not in cond_top.__name__
                      and "True" in cond_sub.__name__
                  ):
                      scope_no = node_scope.split("/")[top_level]
                  else:  # both not equal True
                      scope_no = (
                          node_scope.split("/")[top_level]
                          + "_"
                          + node_scope.split("/")[sub_level]
                      )
                  _insert_scope_node_names_dict(scope_no, node.name)
  
      def cond_x_in_y(x, y):
          return x in y
  
      def cond_True(x, y):
          return True
  
      # Obtain nodes where the scope name that satisfies top_level is top_scope and sub_level is sub_scope
      if top_scope and sub_scope:
          _get_scope_name_dict_by_cond(cond_x_in_y, cond_x_in_y)
      # Obtain nodes where the scope name that satisfies in sub_level is sub_scope
      elif not top_scope and sub_scope:
          _get_scope_name_dict_by_cond(cond_True, cond_x_in_y)
      # Obtain nodes where the scope name that satisfies in top_level is top_scope
      elif top_scope and not sub_scope:
          _get_scope_name_dict_by_cond(cond_x_in_y, cond_True)
      # Obtain all nodes grouped by sub_level sub_scope
      elif top_scope is None and sub_scope is None:
          top_scopes = self.scope_level_name_map[top_level]
          for (
              top_scope
          ) in (
              top_scopes
          ):  # this top_scope will replace the input top_scope
              _get_scope_name_dict_by_cond(cond_x_in_y, cond_True)
  
      return scope_node_names
  
file_path: MMdnn/mmdnn/conversion/rewriter/folder.py
imports: from mmdnn.conversion.common.IR.IR_graph import *
  import sys
  import re
  import numpy
  import collections
label_desc: Use image node_id 5 for calling the Folder obj's underlying member method code with example usage: obj._get_scope_name_dict(node_list, top_level, top_scope, sub_level, sub_scope) and returns: scope_node_names, unknown, True