code: def get_additional_bytes_to_reach_memory_usage_pct(pct: float) -> int:
      used = get_used_memory()
      total = get_system_memory()
      bytes_needed = int(total * pct) - used
      assert (
          bytes_needed > 0
      ), "memory usage is already above the target. Increase the target percentage."
      return bytes_needed
  
file_path: ray/doc/source/ray-core/doc_code/ray_oom_prevention.py
imports: import ray
  import ray
  from math import ceil
  import ray
  from ray._private.utils import get_system_memory
  from ray._private.utils import get_used_memory
label_desc: Use image node_id 2 for calling a global function with example usage: get_additional_bytes_to_reach_memory_usage_pct(pct) and returns: bytes_needed