code: def from_str(cls, memory_type):
      if isinstance(memory_type, str):
          memory_type = memory_type.lower()
      elif isinstance(memory_type, cls):
          return memory_type
  
      try:
          return cls[memory_type]
      except KeyError:
          raise ValueError(
              'Parameter memory_type must be one of "device", '
              '"host", "managed" or "mirror"'
          )
  
file_path: cuml/python/cuml/internals/mem_type.py
imports: from enum import Enum, auto
  from cuml.internals.device_support import GPU_ENABLED
  from cuml.internals.safe_imports import cpu_only_import, gpu_only_import
label_desc: Use image node_id 1 for calling the MemoryType obj's underlying member method code with example usage: obj.from_str(cls, memory_type) and returns: cls, memory_type