'Rename a file.
This method issues the I{RNFR}/I{RNTO} command sequence to rename
C{pathFrom} to C{pathTo}.
@param: pathFrom: the absolute path to the file to be renamed
@type pathFrom: C{str}
@param: pathTo: the absolute path to rename the file to.
@type pathTo: C{str}
@return: A L{Deferred} which fires when the rename operation has
succeeded or failed.  If it succeeds, the L{Deferred} is called
back with a two-tuple of lists.  The first list contains the
responses to the I{RNFR} command.  The second list contains the
responses to the I{RNTO} command.  If either I{RNFR} or I{RNTO}
fails, the L{Deferred} is errbacked with L{CommandFailed} or
L{BadResponse}.
@rtype: L{Deferred}
@since: 8.2'

def rename(self, pathFrom, pathTo):

    renameFrom = self.queueStringCommand(('RNFR    ' + self.escapePath(pathFrom)))
    renameTo = self.queueStringCommand(('RNTO    ' + self.escapePath(pathTo)))
    fromResponse = []
    result = defer.Deferred()
    result.addCallback((lambda toResponse: (fromResponse, toResponse)))
    def ebFrom(failure):
        self.popCommandQueue()
        result.errback(failure)
    renameFrom.addCallbacks(fromResponse.extend, ebFrom)
    renameTo.chainDeferred(result)
    return result
