code: def _generate_from_spec(spec: types.NestedSpec) -> types.NestedArray:
      """Generate a value from a potentially nested spec."""
      return tree.map_structure(
          lambda s: _normalize_array(s).generate_value(), spec
      )
  
imports: import threading
  from typing import List, Mapping, Optional, Sequence, Callable, Iterator
  from acme import core
  from acme import specs
  from acme import types
  from acme import wrappers
  import dm_env
  import numpy
  import reverb
  from rlds import rlds_types
  import tensorflow
  import tree
label_desc: Use image node_id 3 for calling a global function with example usage: _generate_from_spec(spec) and returns: tree