nodes: 0, module; 1, function_definition; 2, function_name:add_from_names_to_locals; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, for_statement; 11, comment:"""Store imported names to the locals
  
          Resort the locals if coming from a delayed node
          """; 12, assignment; 13, function_name:sort_locals; 14, parameters; 15, block; 16, tuple_pattern; 17, attribute; 18, block; 19, identifier:_key_func; 20, lambda; 21, identifier:my_list; 22, expression_statement; 23, identifier:name; 24, identifier:asname; 25, identifier:node; 26, identifier:names; 27, if_statement; 28, lambda_parameters; 29, attribute; 30, call; 31, comparison_operator:name == "*"; 32, block; 33, else_clause; 34, identifier:node; 35, identifier:node; 36, identifier:fromlineno; 37, attribute; 38, argument_list; 39, identifier:name; 40, string:"*"; 41, try_statement; 42, for_statement; 43, block; 44, identifier:my_list; 45, identifier:sort; 46, keyword_argument; 47, block; 48, except_clause; 49, identifier:name; 50, call; 51, block; 52, expression_statement; 53, expression_statement; 54, identifier:key; 55, identifier:_key_func; 56, expression_statement; 57, attribute; 58, block; 59, attribute; 60, argument_list; 61, expression_statement; 62, expression_statement; 63, call; 64, call; 65, assignment; 66, identifier:exceptions; 67, identifier:AstroidBuildingError; 68, continue_statement; 69, identifier:imported; 70, identifier:public_names; 71, call; 72, call; 73, attribute; 74, argument_list; 75, identifier:sort_locals; 76, argument_list; 77, identifier:imported; 78, call; 79, attribute; 80, argument_list; 81, identifier:sort_locals; 82, argument_list; 83, attribute; 84, identifier:set_local; 85, boolean_operator; 86, identifier:node; 87, subscript; 88, attribute; 89, argument_list; 90, attribute; 91, identifier:set_local; 92, identifier:name; 93, identifier:node; 94, subscript; 95, identifier:node; 96, identifier:parent; 97, identifier:asname; 98, identifier:name; 99, attribute; 100, boolean_operator; 101, identifier:node; 102, identifier:do_import_module; 103, identifier:node; 104, identifier:parent; 105, attribute; 106, identifier:name; 107, call; 108, identifier:locals; 109, identifier:asname; 110, identifier:name; 111, call; 112, identifier:locals; 113, attribute; 114, argument_list; 115, attribute; 116, argument_list; 117, attribute; 118, identifier:scope; 119, attribute; 120, identifier:scope; 121, identifier:node; 122, identifier:parent; 123, identifier:node; 124, identifier:parent
code: def add_from_names_to_locals(self, node):
          """Store imported names to the locals
  
          Resort the locals if coming from a delayed node
          """
          _key_func = lambda node: node.fromlineno
  
          def sort_locals(my_list):
              my_list.sort(key=_key_func)
  
          for (name, asname) in node.names:
              if name == "*":
                  try:
                      imported = node.do_import_module()
                  except exceptions.AstroidBuildingError:
                      continue
                  for name in imported.public_names():
                      node.parent.set_local(name, node)
                      sort_locals(node.parent.scope().locals[name])
              else:
                  node.parent.set_local(asname or name, node)
                  sort_locals(node.parent.scope().locals[asname or name])