<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __imap_search(self, ** criteria_dict):
 """ Searches for query in the given IMAP criteria and returns the message numbers that match as a list of strings. Criteria without values (eg DELETED) should be keyword args with KEY=True, or else not passed. Criteria with values should be keyword args of the form KEY="VALUE" where KEY is a valid IMAP key. IMAP default is to AND all criteria together. We don't support other logic quite yet. All valid keys: ALL, ANSWERED, BCC <string>, BEFORE <string>, BODY <string>, CC <string>, DELETED, DRAFT, FLAGGED, FROM <string>, HEADER <field-name> <string> (UNTESTED), KEYWORD <flag>, LARGER <n>, NEW, NOT <search-key>, OLD, ON <date>, OR <search-key1> <search-key2> (UNTESTED), RECENT, SEEN, SENTBEFORE <date>, SENTON <date>, SENTSINCE <date>, SINCE <date>, SMALLER <n>, SUBJECT <string>, TEXT <string>, TO <string>, UID <sequence set>, UNANSWERED, UNDELETED, UNDRAFT, UNFLAGGED, UNKEYWORD <flag>, UNSEEN. For details on keys and their values, see http://tools.ietf.org/html/rfc3501#section-6.4.4 :param criteria_dict: dictionary of search criteria keywords :raises: EmailException if something in IMAP breaks :returns: List of message numbers as strings matched by given criteria """

        self.imap_connect()

        criteria = []
        for key in criteria_dict:
            if criteria_dict[key] is True:
                criteria.append('(%s)' % key)
            else:
                criteria.append('(%s "%s")' % (key, criteria_dict[key]))

        # If any of these criteria are not valid IMAP keys, IMAP will tell us.
        status, msg_nums = self.mailbox.search('UTF-8', * criteria)
        self.imap_disconnect()

        if 0 == len(msg_nums):
            msg_nums = []

        if 'OK' in status:
            return self.__parse_imap_search_result(msg_nums)
        else:
            raise EmailException("IMAP status is " + str(status))