class IMAP(imaplib.IMAP4):

    def __init__(self, host='', port=imaplib.IMAP4_PORT, timeout=None):
        self.timeout = timeout
imaplib.IMAP4.__init__(self, host, port)

def open(self, host='', port=imaplib.IMAP4_PORT):
    self.host = host
self.port = port
self.sock = socket.create_connection((host, port), timeout=self.timeout)
self.sock.settimeout(None)
self.file = self.sock.makefile('rb')
Позволяет ли imaplib Python установить тайм-аут?