code: def _train_function(
      train_actors: DistributedActors,
      algorithm_config: ImpalaAlgorithmConfig,
  ) -> IMPALA:
      impala = IMPALA(
          model=_policy(train_actors.env_factory()),
          rollout_generator=train_actors,
          evaluator=algorithm_config.rollout_evaluator,
          algorithm_config=algorithm_config,
          model_selection=None,
      )
  
      impala.train(n_epochs=algorithm_config.n_epochs)
  
      return impala
  
imports: import torch.nn
  from maze.core.agent.torch_actor_critic import TorchActorCritic
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.agent.torch_state_critic import TorchSharedStateCritic
  from maze.core.wrappers.maze_gym_env_wrapper import GymMazeEnv
  from maze.distributions.distribution_mapper import DistributionMapper
  from maze.perception.models.built_in.flatten_concat import FlattenConcatPolicyNet, FlattenConcatStateValueNet
  from maze.train.parallelization.distributed_actors.distributed_actors import DistributedActors
  from maze.train.parallelization.distributed_actors.sequential_distributed_actors import SequentialDistributedActors
  from maze.train.parallelization.distributed_actors.subproc_distributed_actors import SubprocDistributedActors
  from maze.train.parallelization.vector_env.sequential_vector_env import SequentialVectorEnv
  from maze.train.trainers.common.evaluators.rollout_evaluator import RolloutEvaluator
  from maze.train.trainers.impala.impala_algorithm_config import ImpalaAlgorithmConfig
  from maze.train.trainers.impala.impala_trainer import IMPALA
  from maze.utils.timeout import Timeout
label_desc: Use image node_id 4 for calling a global function with example usage: _train_function(train_actors, algorithm_config) and returns: impala