code: def memory_events(
      self,
      run,
      worker,
      span,
      device_type,
      min_size=0,
      max_size=float("inf"),
      search_name=None,
      time_unit="ms",
  ):
      if device_type == "undefined":
          return
      try:
          min_size = float(min_size)
      except Exception:
          min_size = 0
      try:
          max_size = float(max_size)
      except Exception:
          max_size = float("inf")
      if search_name == "undefined" or not search_name:
          search_name = None
      run_manager = self._reader.get_run_manager(run)
      if run_manager is None:
          return []
      profiler_data = run_manager.get_profiler_data(worker, span)
      if profiler_data:
          return profiler_data.get_memory_events(
              device_type, min_size, max_size, search_name, time_unit
          )
  
imports: import json
  from .profiler_reader import ProfilerReader
  from visualdl.server.api import gen_result
  from visualdl.server.api import result
label_desc: Use image node_id 28 for calling the ProfilerApi obj's underlying member method code with example usage: obj.memory_events(run, worker, span, device_type, min_size, max_size, search_name, time_unit) and returns: list, profiler_data