code: def count(memory_str, substr):
      substr = substr[:42]
      n = 0
      for line in memory_str.split("\n"):
          if substr in line:
              n += 1
      return n
  
file_path: ray/python/ray/tests/test_memstat.py
imports: import os
  import time
  import numpy
  import pytest
  import ray
  from ray._private.internal_api import memory_summary
  from ray._private.test_utils import Semaphore, wait_for_condition
  from ray.cluster_utils import Cluster, cluster_not_supported
label_desc: Use image node_id 3 for calling a global function with example usage: count(memory_str, substr) and returns: n