code: def setup_early_mixins(
      policy: Policy,
      obs_space: gym.spaces.Space,
      action_space: gym.spaces.Space,
      config: AlgorithmConfigDict,
  ) -> None:
      """Call mixin classes' constructors before Policy's initialization.
  
      Adds the necessary optimizers to the given Policy.
  
      Args:
          policy: The Policy object.
          obs_space (gym.spaces.Space): The Policy's observation space.
          action_space (gym.spaces.Space): The Policy's action space.
          config: The Policy's config.
      """
      policy.cur_iter = 0
      ActorCriticOptimizerMixin.__init__(policy, config)
      if config["lagrangian"]:
          policy.model.log_alpha_prime = get_variable(
              0.0,
              framework="tf",
              trainable=True,
              tf_name="log_alpha_prime",
          )
          policy.alpha_prime_optim = tf.keras.optimizers.Adam(
              learning_rate=config["optimization"][
                  "critic_learning_rate"
              ],
          )
      # Generic random action generator for calculating CQL-loss.
      policy._random_action_generator = Random(
          action_space,
          model=None,
          framework="tf2",
          policy_config=config,
          num_workers=0,
          worker_index=0,
      )
  
imports: from functools import partial
  import numpy
  import gymnasium
  import logging
  import tree
  from typing import Dict, List, Type, Union
  import ray
  import ray.experimental.tf_utils
  from ray.rllib.algorithms.sac.sac_tf_policy import apply_gradients, compute_and_clip_gradients, get_distribution_inputs_and_class, _get_dist_class, build_sac_model, postprocess_trajectory, setup_late_mixins, stats, validate_spaces, ActorCriticOptimizerMixin, ComputeTDErrorMixin
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.tf.tf_action_dist import TFActionDistribution
  from ray.rllib.policy.tf_mixins import TargetNetworkMixin
  from ray.rllib.policy.tf_policy_template import build_tf_policy
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.exploration.random import Random
  from ray.rllib.utils.framework import get_variable, try_import_tf, try_import_tfp
  from ray.rllib.utils.typing import LocalOptimizer, ModelGradients, TensorType, AlgorithmConfigDict
label_desc: Use image node_id 6 for calling a global function with example usage: setup_early_mixins(policy, obs_space, action_space, config) without return types