'Helper function to wait for completion of passed function'

def _wait_for_completion(self, help_func, args, retry_count):

    def _call_loop(loop_args):
        remaining = loop_args['retries']
        args = loop_args['args']
        LOG.debug('In    call    loop    (%(remaining)d)    %(args)s', {'remaining': remaining, 'args': args})
        (remaining, response) = loop_args['func'](args, remaining)
        if (remaining == 0):
            raise loopingcall.LoopingCallDone(response)
        loop_args['retries'] = remaining
    loop_args = {}
    loop_args['retries'] = retry_count
    loop_args['func'] = help_func
    loop_args['args'] = args
    interval = self.configuration.ise_retry_interval
    timer = loopingcall.FixedIntervalLoopingCall(_call_loop, loop_args)
    return timer.start(interval).wait()
