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
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.