def mailbox(name, delim = '/')
    retries = 0

    name.gsub!(/^(inbox\/?)/i){ $1.upcase }
    name.gsub!(delim, self.delim)

    # Gmail doesn't allow folders with leading or trailing whitespace.
    name.strip! if @quirks[:gmail]
    
    #Rackspace namespaces everything under INDEX.
    name.sub!(/^|inbox\./i, "INBOX.") if @quirks[:rackspace] && name != 'INBOX'

    begin
      @mailboxes.fetch(name) do
        update_mailboxes
        return @mailboxes[name] if @mailboxes.has_key?(name)
        raise MailboxNotFoundError, "mailbox not found: #{name}"
      end

    rescue MailboxNotFoundError => e
      raise unless @options[:create_mailbox] && retries == 0

      info "creating mailbox: #{name}"
      safely { @conn.create(Net::IMAP.encode_utf7(name)) } unless @options[:dry_run]

      retries += 1
      retry
    end
  end
def mailbox(name, delim = '/')
    retries = 0

    name.gsub!(/^(inbox\/?)/i){ $1.upcase }
    name.gsub!(delim, self.delim)

    # Gmail doesn't allow folders with leading or trailing whitespace.
    name.strip! if @quirks[:gmail]
    
    #Rackspace namespaces everything under INDEX.
    name.sub!(/^|inbox\./i, "INBOX.") if @quirks[:rackspace] && name != 'INBOX'

    begin
      @mailboxes.fetch(name) do
        update_mailboxes
        return @mailboxes[name] if @mailboxes.has_key?(name)
        raise MailboxNotFoundError, "mailbox not found: #{name}"
      end

    rescue MailboxNotFoundError => e
      raise unless @options[:create_mailbox] && retries == 0

      info "creating mailbox: #{name}"
      safely { @conn.create(Net::IMAP.encode_utf7(name)) } unless @options[:dry_run]

      retries += 1
      retry
    end
  end
Gets a Larch::IMAP::Mailbox instance representing the specified mailbox. If
 the mailbox doesn't exist and the <tt>:create_mailbox</tt> option is
 +false+, or if <tt>:create_mailbox</tt> is +true+ and mailbox creation
 fails, a Larch::IMAP::MailboxNotFoundError will be raised.