nodes: 0, module; 1, function_definition; 2, function_name:map_aliases_to_device_objects; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
              A device object knows its rid, but not its alias.
              A portal object knows its device rids and aliases.
  
              This function adds an 'portals_aliases' key to all of the 
              device objects so they can be sorted by alias.
          """; 11, assignment; 12, identifier:dev_o; 13, identifier:all_devices; 14, block; 15, identifier:all_devices; 16, identifier:all_devices; 17, call; 18, expression_statement; 19, attribute; 20, argument_list; 21, assignment; 22, identifier:self; 23, identifier:get_all_devices_in_portal; 24, subscript; 25, subscript; 26, identifier:dev_o; 27, string; 28, subscript; 29, subscript; 30, string_content:portals_aliases; 31, subscript; 32, string; 33, identifier:dev_o; 34, string; 35, subscript; 36, string; 37, string_content:aliases; 38, string_content:rid; 39, subscript; 40, integer:1; 41, string_content:info; 42, call; 43, integer:2; 44, attribute; 45, argument_list; 46, identifier:self; 47, identifier:get_portal_by_name; 48, call; 49, attribute; 50, argument_list; 51, identifier:self; 52, identifier:portal_name
code: def map_aliases_to_device_objects(self):
          """
              A device object knows its rid, but not its alias.
              A portal object knows its device rids and aliases.
  
              This function adds an 'portals_aliases' key to all of the 
              device objects so they can be sorted by alias.
          """
          all_devices = self.get_all_devices_in_portal()
          for dev_o in all_devices:
              dev_o['portals_aliases'] = self.get_portal_by_name(
                                                          self.portal_name()
                                                  )[2][1]['info']['aliases'][ dev_o['rid'] ]
          return all_devices