code: def calculate_capacity_threshold(disk_capacity_in_bytes):
      usage = shutil.disk_usage("/tmp")
      threshold = min(
          1,
          1.0
          - 1.0 * (usage.free - disk_capacity_in_bytes) / usage.total,
      )
      return threshold
  
file_path: ray/python/ray/tests/test_out_of_disk_space.py
imports: import os
  import platform
  import shutil
  import sys
  import tempfile
  import time
  from contextlib import contextmanager
  import numpy
  import pytest
  import ray
  from ray.util.state import list_cluster_events
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_capacity_threshold(disk_capacity_in_bytes) and returns: threshold