code: def _make_deep_sea_stochastic_dataset(environment: deep_sea.DeepSea):
      """Make stochastic DeepSea demonstration dataset."""
  
      recorder = DemonstrationRecorder()
  
      # Use 10*size demos, 80% success, 20% failure.
      num_demos = (
          environment._size * 10
      )  # pylint: disable=protected-access
      num_failures = num_demos // 5
      num_successes = num_demos - num_failures
  
      successes_saved = 0
      failures_saved = 0
      while (successes_saved < num_successes) or (
          failures_saved < num_failures
      ):
          _run_optimal_deep_sea_episode(environment, recorder)
  
          if (
              recorder.episode_reward > 0
              and successes_saved < num_successes
          ):
              recorder.record_episode()
              successes_saved += 1
          elif (
              recorder.episode_reward <= 0
              and failures_saved < num_failures
          ):
              recorder.record_episode()
              failures_saved += 1
          else:
              recorder.discard_episode()
  
      return recorder.make_tf_dataset()
  
imports: from typing import Any, List
  from absl import flags
  from bsuite.environments import deep_sea
  import dm_env
  import numpy
  import tensorflow
  import tree
label_desc: Use image node_id 5 for calling a global function with example usage: _make_deep_sea_stochastic_dataset(environment) and returns: recorder