def renameRemote(self, remote, new):
        old = remote.name
        if new != old:
            if new in self.nameRemotes or new in (self.local.name, ):
                emsg = "Cannot rename remote to '{0}', already exists.".format(new)
                raise ValueError(emsg)
            if old not in self.nameRemotes:
                emsg = "Cannot rename remote '{0}', does not exist.".format(old)
                raise ValueError(emsg)
            if remote is not self.nameRemotes[old]:
                emsg = "Cannot rename remote '{0}', not identical.".format(old)
                raise ValueError(emsg)
            remote.name = new
            index = self.nameRemotes.keys().index(old)
            del self.nameRemotes[old]
            self.nameRemotes.insert(index, new, remote)
Factory for package item presenter objects, choosing one of
dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/proto/stacking.py/Stack.renameRemote--crossover with--dataset/ETHPy150Open python-openxml/opc-diag/opcdiag/presenter.py/ItemPresenter.__new__