Check the public key of a node on the network to see if they are
            permitted to participate. The roles being checked are the
            following, from first to last:
                "network"
                "default"

            The first role that is set will be the one used to enforce if the
            node is allowed.

            Args:
                public_key (string): The public key belonging to a node on the
                    network

def check_network_role(self, public_key):
        """ Check the public key of a node on the network to see if they are
            permitted to participate. The roles being checked are the
            following, from first to last:
                "network"
                "default"

            The first role that is set will be the one used to enforce if the
            node is allowed.

            Args:
                public_key (string): The public key belonging to a node on the
                    network
        """
        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)
        role = self._cache.get_role("network", state_root)

        if role is None:
            policy_name = "default"
        else:
            policy_name = role.policy_name
        policy = self._cache.get_policy(policy_name, state_root)
        if policy is not None:
            if not self._allowed(public_key, policy):
                LOGGER.debug("Node is not permitted: %s.", public_key)
                return False
        return True