def wait_for_and_get_block(self, block_number, blocks_waiting_for=None):
if not blocks_waiting_for:<EOL><INDENT>blocks_waiting_for = max(<NUM_LIT:1>, block_number - self.get_current_block_num())<EOL><DEDENT>repetition = <NUM_LIT:0><EOL>while self.get_current_block_num() < block_number:<EOL><INDENT>repetition += <NUM_LIT:1><EOL>time.sleep(self.block_interval)<EOL>if repetition > blocks_waiting_for * self.max_block_wait_repetition:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT><DEDENT>block = self.blockchain.rpc.get_block(block_number)<EOL>repetition = <NUM_LIT:0><EOL>while not block:<EOL><INDENT>repetition += <NUM_LIT:1><EOL>time.sleep(self.block_interval)<EOL>if repetition > self.max_block_wait_repetition:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>block = self.blockchain.rpc.get_block(block_number)<EOL><DEDENT>return block<EOL>
Get the desired block from the chain, if the current head block is
            smaller (for both head and irreversible) then we wait, but a
            maxmimum of blocks_waiting_for * max_block_wait_repetition time
            before failure.

            :param int block_number: desired block number
            :param int blocks_waiting_for: (default) difference between
                block_number and current head how many blocks we are willing to
                wait, positive int