code: def _actor_worker(
      pickled_env_factory: bytes,
      pickled_policy: bytes,
      n_rollout_steps: int,
      actor_output_queue: multiprocessing.Queue,
      broadcasting_container: BroadcastingContainer,
      env_seed: int,
      agent_seed: int,
  ):
      """Worker function for the actors. This Method is called with a new process. Its task is to initialize the,
          before going into a loop - updating its policy if necessary, computing a rollout and putting the result into
          the shared queue.
  
      :param pickled_env_factory: The pickled env factory
      :param pickled_policy: Pickled structured policy
      :param n_rollout_steps: the number of rollout steps to be computed for each rollout
      :param actor_output_queue: the queue to put the computed rollouts in
      :param broadcasting_container: the shared container, where actors can retrieve the newest version of the policies
      :param env_seed: The env seed to be used.
      :param agent_seed: The agent seed to be used.
      """
      try:
          env_factory = cloudpickle.loads(pickled_env_factory)
          env = env_factory()
          env.seed(env_seed)
  
          policy: TorchPolicy = cloudpickle.loads(pickled_policy)
          policy.seed(agent_seed)
          policy_version_counter = -1
  
          rollout_generator = RolloutGenerator(
              env=env, record_logits=True, record_episode_stats=True
          )
  
          while not broadcasting_container.stop_flag():
              # Update the policy if new version is available
              shared_policy_version_counter = (
                  broadcasting_container.policy_version()
              )
              if policy_version_counter < shared_policy_version_counter:
                  policy.load_state_dict(
                      broadcasting_container.policy_state_dict()
                  )
                  policy_version_counter = shared_policy_version_counter
  
              trajectory = rollout_generator.rollout(
                  policy, n_steps=n_rollout_steps
              )
              actor_output_queue.put(trajectory)
  
      except Exception as e:
          actor_output_queue.put(ExceptionReport(e))
  
imports: import time
  from typing import Callable, Union, Tuple, Dict, List
  import cloudpickle
  from torch import multiprocessing
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.annotations import override
  from maze.core.env.structured_env import StructuredEnv
  from maze.core.env.structured_env_spaces_mixin import StructuredEnvSpacesMixin
  from maze.core.log_stats.log_stats_env import LogStatsEnv
  from maze.core.rollout.rollout_generator import RolloutGenerator
  from maze.core.trajectory_recording.records.structured_spaces_record import StructuredSpacesRecord
  from maze.core.trajectory_recording.records.trajectory_record import SpacesTrajectoryRecord
  from maze.perception.perception_utils import convert_to_torch
  from maze.train.parallelization.broadcasting_container import BroadcastingContainer, BroadcastingManager
  from maze.train.parallelization.distributed_actors.distributed_actors import DistributedActors
  from maze.utils.exception_report import ExceptionReport
label_desc: Use image node_id 1 for calling a global function with example usage: _actor_worker(pickled_env_factory, pickled_policy, n_rollout_steps, actor_output_queue, broadcasting_container, env_seed, agent_seed) without return types