code: def is_batch_signer_authorized(self, batch, state_root=None,
                                     from_state=False):
          
          if state_root is None:
              state_root = self._current_root_func()
              if state_root == INIT_ROOT_KEY:
                  LOGGER.debug("Chain head is not set yet. Permit all.")
                  return True
  
          self._cache.update_view(state_root)
  
          header = BatchHeader()
          header.ParseFromString(batch.header)
  
          role = self._cache.get_role(
              "transactor.batch_signer",
              state_root,
              from_state)
  
          if role is None:
              role = self._cache.get_role("transactor", state_root, from_state)
  
          if role is None:
              policy_name = "default"
          else:
              policy_name = role.policy_name
  
          policy = self._cache.get_policy(policy_name, state_root, from_state)
          if policy is None:
              allowed = True
          else:
              allowed = self._allowed(header.signer_public_key, policy)
  
          if allowed:
              return self.is_transaction_signer_authorized(
                  batch.transactions,
                  state_root,
                  from_state)
          LOGGER.debug("Batch Signer: %s is not permitted.",
                       header.signer_public_key)
          return False
docs: Check the batch signing key against the allowed transactor
              permissions. The roles being checked are the following, from first
              to last:
                  "transactor.batch_signer"
                  "transactor"
                  "default"
  
              The first role that is set will be the one used to enforce if the
              batch signer is allowed.
  
              Args:
                  batch (Batch): The batch that is being verified.
                  state_root(string): The state root of the previous block. If
                      this is None, the current state root hash will be
                      retrieved.
                  from_state (bool): Whether the identity value should be read
                      directly from state, instead of using the cached values.
                      This should be used when the state_root passed is not from
                      the current chain head.