#NEWLINE# def bpop( self , keys , tail = False , timeout = 30 ) : #NEWLINE# #INDENT# "\n        @param keys a list of one or more Redis keys of non-empty list(s)\n        @param tail pop element from tail instead of head\n        @param timeout max number of seconds block for (0 is forever)\n\n        BLPOP (and BRPOP) is a blocking list pop primitive. You can see\n        this commands as blocking versions of LPOP and RPOP able to block\n        if the specified keys don't exist or contain empty lists.\n        The following is a description of the exact semantic. We\n        describe BLPOP but the two commands are identical, the only\n        difference is that BLPOP pops the element from the left (head)\n        of the list, and BRPOP pops from the right (tail).\n\n        Non blocking behavior\n        When BLPOP is called, if at least one of the specified keys\n        contain a non empty list, an element is popped from the head of\n        the list and returned to the caller together with the name of\n        the key (BLPOP returns a two elements array, the first element\n        is the key, the second the popped value).\n        Keys are scanned from left to right, so for instance if you\n        issue BLPOP list1 list2 list3 0 against a dataset where list1\n        does not exist but list2 and list3 contain non empty lists,\n        BLPOP guarantees to return an element from the list stored at\n        list2 (since it is the first non empty list starting from the\n        left).\n\n        Blocking behavior\n        If none of the specified keys exist or contain non empty lists,\n        BLPOP blocks until some other client performs a LPUSH or an\n        RPUSH operation against one of the lists.\n        Once new data is present on one of the lists, the client\n        finally returns with the name of the key unblocking it and the\n        popped value.\n        When blocking, if a non-zero timeout is specified, the client\n        will unblock returning a nil special value if the specified\n        amount of seconds passed without a push operation against at\n        least one of the specified keys.\n        A timeout of zero means instead to block forever.\n\n        Multiple clients blocking for the same keys\n        Multiple clients can block for the same key. They are put into\n        a queue, so the first to be served will be the one that started\n        to wait earlier, in a first-blpopping first-served fashion.\n\n        Return value\n        BLPOP returns a two-elements array via a multi bulk reply in\n        order to return both the unblocking key and the popped value.\n        When a non-zero timeout is specified, and the BLPOP operation\n        timed out, the return value is a nil multi bulk reply. Most\n        client values will return false or nil accordingly to the\n        programming language used.\n        " #NEWLINE# cmd = ( 'BRPOP' if tail else 'BLPOP' ) #NEWLINE# self . _send ( self , * ( list ( keys ) + [ str ( timeout ) ] ) ) #NEWLINE# return self . getResponse ( )