<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort_device(self):
 """ Sort device to follow the order of initialization :return: None """


        self.devices.sort()
        # idx: the indices of order-sensitive models
        # names: an ordered list of order-sensitive models
        idx = []
        names = []
        for dev in order:
            # if ``dev`` in ``order`` is a model file name:
            #   initialize the models in alphabet order
            if dev in all_models:
                all_dev = list(sorted(all_models[dev].keys()))
                for item in all_dev:
                    if item in self.devices:
                        idx.append(self.devices.index(item))
                        names.append(item)

            # if ``dev`` presents as a model name
            elif dev in self.devices:
                idx.append(self.devices.index(dev))
                names.append(dev)

        idx = sorted(idx)
        for id, name in zip(idx, names):
            self.devices[id] = name