def change_master(self, db, service, service_type, cur_host_inst):
        # If we're not masterful, or current host is already master: pass.
        if service_type != 'masterful' or aerostat.check_master(
                db, service, cur_host_inst):

            return False

        cur_master_inst = aerostat.get_master(db, service)
        master_hostname = '%s-master' % (service,)
        if cur_master_inst:
            # There is a master instance alive; null out its hostname.
            self.change_hostname(db, '' , inst=cur_master_inst)

        self.change_hostname(db, '', inst=cur_host_inst)
        self.change_hostname(db, master_hostname, inst=cur_host_inst)
        if cur_master_inst:
            # Find a place to put the old master.
            new_master = self.pick_name(db, service,
                    service_type, cur_master_inst)
            self.change_hostname(db, new_master, inst=cur_master_inst)

        return True
Change cur_host to cur_master's hostname in aerostat.
dataset/ETHPy150Open urbanairship/aerostat/aerostat/registrar.py/Registrar.change_master