def rename(self, oldname, newname):
        oldname = oldname.upper()
        newname = newname.upper()
        if oldname not in self.mailboxes:
            raise NoSuchMailbox, oldname

        inferiors = self._inferiorNames(oldname)
        inferiors = [(o, o.replace(oldname, newname, 1)) for o in inferiors]

        for (old, new) in inferiors:
            if new in self.mailboxes:
                raise MailboxCollision, new

        for (old, new) in inferiors:
            self.mailboxes[new] = self.mailboxes[old]
            del self.mailboxes[old]
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/mail/imap4.py/MemoryAccount.rename/original