class_docstr: Device specification.
class_docstr_tok: ["Device","specification","."]
docstr: Construct an AutoDist DeviceSpec based on its name string.
  
  Args:
      name_string: AutoDist DeviceSpec name string
  
  Returns:
      DeviceSpec: an instance
code: def from_string(cls, name_string):
      """
      Construct an AutoDist DeviceSpec based on its name string.
  
      Args:
          name_string: AutoDist DeviceSpec name string
  
      Returns:
          DeviceSpec: an instance
      """
      address, device_type, device_index = re.match(
          r"(\S+):([a-zA-Z]+):(\d+)", name_string
      ).groups()
      obj = cls(
          address,
          device_type=DeviceType[device_type],
          device_index=device_index,
      )
      return obj
  
imports: import os
  import re
  from enum import Enum
  from typing import NamedTuple, Optional, Dict
  import yaml
  import paramiko
  from autodist.utils import logging
  from autodist.utils.network import is_loopback_address, is_local_address
label_desc: Use image node_id 3 for calling the DeviceSpec obj's underlying member method code with example usage: obj.from_string(cls, name_string) and returns: obj