code: def _check_approval_wrapper(self, grr_object, grr_function, *args, **kwargs):
      
      approval_sent = False
  
      while True:
        try:
          return grr_function(*args, **kwargs)
        except grr_errors.AccessForbiddenError as exception:
          print('No valid approval found: {0!s}'.format(exception))
          # If approval was already sent, just wait a bit more.
          if approval_sent:
            print('Approval not yet granted, waiting {0:d}s'.format(
                self._CHECK_APPROVAL_INTERVAL_SEC))
            time.sleep(self._CHECK_APPROVAL_INTERVAL_SEC)
            continue
  
          # If no approvers were specified, abort.
          if not self.approvers:
            message = ('GRR needs approval but no approvers specified '
                       '(hint: use --approvers)')
            self.state.add_error(message, critical=True)
            return None
  
          # Otherwise, send a request for approval
          grr_object.CreateApproval(
              reason=self.reason, notified_users=self.approvers)
          approval_sent = True
          print('{0!s}: approval request sent to: {1!s} (reason: {2:s})'.format(
              grr_object, self.approvers, self.reason))
docs: Wraps a call to GRR functions checking for approval.
  
      Args:
        grr_object: the GRR object to create the eventual approval on.
        grr_function: The GRR function requiring approval.
        *args: Positional arguments that are to be passed to `grr_function`.
        **kwargs: Keyword arguments that are to be passed to `grr_function`.
  
      Returns:
        The return value of the execution of grr_function(*args, **kwargs).