'Return a Folder instance of this Maildir
If necessary, scan and cache all foldernames to make sure that
we only return existing folders and that 2 calls with the same
name will return the same object.'

def getfolder(self, foldername):

    folders = self.getfolders()
    for f in folders:
        if (foldername == f.name):
            return f
    raise OfflineImapError(("getfolder()    asked    for    a    nonexisting    folder    '%s'." % foldername), OfflineImapError.ERROR.FOLDER)
