'Search messages in the currently selected mailbox
This command is allowed in the Selected state.
Any non-zero number of queries are accepted by this method, as
returned by the C{Query}, C{Or}, and C{Not} functions.
One keyword argument is accepted: if uid is passed in with a non-zero
value, the server is asked to return message UIDs instead of message
sequence numbers.
@rtype: C{Deferred}
@return: A deferred whose callback will be invoked with a list of all
the message sequence numbers return by the search, or whose errback
will be invoked if there is an error.'

def search(self, *queries, **kwarg):

    if kwarg.get('uid'):
        cmd = 'UID    SEARCH'
    else:
        cmd = 'SEARCH'
    args = '    '.join(queries)
    d = self.sendCommand(Command(cmd, args, wantResponse=(cmd,)))
    d.addCallback(self.__cbSearch)
    return d
