code: def from_str(cls, device_type):
      if isinstance(device_type, str):
          device_type = device_type.lower()
  
      if device_type in ("cpu", "host", DeviceType.host):
          return cls.host
      elif device_type in ("gpu", "device", DeviceType.device):
          return cls.device
      else:
          raise ValueError(
              'Parameter device_type must be one of "cpu" or ' '"gpu"'
          )
  
file_path: cuml/python/cuml/internals/device_type.py
imports: from enum import Enum, auto
  from cuml.internals.mem_type import MemoryType
label_desc: Use image node_id 1 for calling the DeviceType obj's underlying member method code with example usage: obj.from_str(cls, device_type) and returns: cls, cls