code: def from_string(cls, resource_name):
          
          # TODO Remote VISA
  
          uname = resource_name.upper()
  
          for interface_type in _INTERFACE_TYPES:
  
              # Loop through all known interface types until we found one
              # that matches the beginning of the resource name
              if not uname.startswith(interface_type):
                  continue
  
              if len(resource_name) == len(interface_type):
                  parts = ()
              else:
                  parts = resource_name[len(interface_type):].split('::')
  
              # Try to match the last part of the resource name to
              # one of the known resource classes for the given interface type.
              # If not possible, use the default resource class
              # for the given interface type.
              if parts and parts[-1] in _RESOURCE_CLASSES[interface_type]:
                  parts, resource_class = parts[:-1], parts[-1]
              else:
                  try:
                      resource_class = _DEFAULT_RC[interface_type]
                  except KeyError:
                      raise InvalidResourceName.rc_notfound(interface_type,
                                                            resource_name)
  
              # Look for the subclass
              try:
                  subclass = _SUBCLASSES[(interface_type, resource_class)]
              except KeyError:
                  raise InvalidResourceName.subclass_notfound(
                      (interface_type, resource_class), resource_name)
  
              # And create the object
              try:
                  rn = subclass.from_parts(*parts)
                  rn.user = resource_name
                  return rn
              except ValueError as ex:
                  raise InvalidResourceName.bad_syntax(subclass._visa_syntax,
                                                       resource_name, ex)
  
          raise InvalidResourceName('Could not parse %s: unknown interface type'
                                    % resource_name)
docs: Parse a resource name and return a ResourceName
  
          :type resource_name: str
          :rtype: ResourceName
  
          :raises InvalidResourceName: if the resource name is invalid.