code: def make_reverb_prioritized_nstep_replay(
      environment_spec: specs.EnvironmentSpec,
      extra_spec: types.NestedSpec = (),
      n_step: int = 1,
      batch_size: int = 32,
      max_replay_size: int = 100_000,
      min_replay_size: int = 1,
      discount: float = 1.0,
      prefetch_size: int = 4,  # TODO(iosband): rationalize prefetch size.
      replay_table_name: str = adders.DEFAULT_PRIORITY_TABLE,
      priority_exponent: Optional[
          float
      ] = None,  # If None, default to uniform.
  ) -> ReverbReplay:
      """Creates a single-process replay infrastructure from an environment spec."""
      # Parsing priority exponent to determine uniform vs prioritized replay
      if priority_exponent is None:
          sampler = reverb.selectors.Uniform()
          priority_fns = {replay_table_name: lambda x: 1.0}
      else:
          sampler = reverb.selectors.Prioritized(priority_exponent)
          priority_fns = None
  
      # Create a replay server to add data to. This uses no limiter behavior in
      # order to allow the Agent interface to handle it.
      replay_table = reverb.Table(
          name=replay_table_name,
          sampler=sampler,
          remover=reverb.selectors.Fifo(),
          max_size=max_replay_size,
          rate_limiter=reverb.rate_limiters.MinSize(min_replay_size),
          signature=adders.NStepTransitionAdder.signature(
              environment_spec, extra_spec
          ),
      )
      server = reverb.Server([replay_table], port=None)
  
      # The adder is used to insert observations into replay.
      address = f"localhost:{server.port}"
      client = reverb.Client(address)
      adder = adders.NStepTransitionAdder(
          client, n_step, discount, priority_fns=priority_fns
      )
  
      # The dataset provides an interface to sample from replay.
      data_iterator = datasets.make_reverb_dataset(
          table=replay_table_name,
          server_address=address,
          batch_size=batch_size,
          prefetch_size=prefetch_size,
      ).as_numpy_iterator()
      return ReverbReplay(server, adder, data_iterator, client=client)
  
file_path: acme/acme/agents/replay.py
imports: import dataclasses
  from typing import Any, Callable, Dict, Iterator, Optional
  from acme import adders
  from acme import datasets
  from acme import specs
  from acme import types
  from acme.adders import reverb
  import reverb
label_desc: Use image node_id 1 for calling a global function with example usage: make_reverb_prioritized_nstep_replay(environment_spec, extra_spec, n_step, batch_size, max_replay_size, min_replay_size, discount, prefetch_size, replay_table_name, priority_exponent) and returns: ReverbReplay