def wait_for_completion(self, response, timeout=<NUM_LIT>, initial_wait=<NUM_LIT:5>, scaleup=<NUM_LIT:10>):
if not response:<EOL><INDENT>return<EOL><DEDENT>logger = logging.getLogger(__name__)<EOL>wait_period = initial_wait<EOL>next_increase = time.time() + wait_period * scaleup<EOL>if timeout:<EOL><INDENT>timeout = time.time() + timeout<EOL><DEDENT>while True:<EOL><INDENT>request = self.get_request(request_id=response['<STR_LIT>'], status=True)<EOL>if request['<STR_LIT>']['<STR_LIT:status>'] == '<STR_LIT>':<EOL><INDENT>break<EOL><DEDENT>elif request['<STR_LIT>']['<STR_LIT:status>'] == '<STR_LIT>':<EOL><INDENT>raise PBFailedRequest(<EOL>'<STR_LIT>'.format(<EOL>response['<STR_LIT>'], request['<STR_LIT>']['<STR_LIT:message>']),<EOL>response['<STR_LIT>']<EOL>)<EOL><DEDENT>current_time = time.time()<EOL>if timeout and current_time > timeout:<EOL><INDENT>raise PBTimeoutError('<STR_LIT>'.format(<EOL>response['<STR_LIT>']), response['<STR_LIT>'])<EOL><DEDENT>if current_time > next_increase:<EOL><INDENT>wait_period *= <NUM_LIT:2><EOL>next_increase = time.time() + wait_period * scaleup<EOL>scaleup *= <NUM_LIT:2><EOL><DEDENT>logger.info("<STR_LIT>",<EOL>response['<STR_LIT>'], request['<STR_LIT>']['<STR_LIT:status>'], wait_period)<EOL>time.sleep(wait_period)<EOL><DEDENT>
Poll resource request status until resource is provisioned.

:param      response: A response dict, which needs to have a 'requestId' item.
:type       response: ``dict``

:param      timeout: Maximum waiting time in seconds. None means infinite waiting time.
:type       timeout: ``int``

:param      initial_wait: Initial polling interval in seconds.
:type       initial_wait: ``int``

:param      scaleup: Double polling interval every scaleup steps, which will be doubled.
:type       scaleup: ``int``