code: def type_from_name(type_name):
      
      if type_name == 'reference':
          # Defer import due to circular import dependencies:
          from .cim_obj import CIMInstanceName
          return CIMInstanceName
      try:
          type_obj = _TYPE_FROM_NAME[type_name]
      except KeyError:
          raise ValueError(
              _format("Unknown CIM data type name: {0!A}", type_name))
      return type_obj
docs: Return the Python type object for a given CIM data type name.
  
      For example, type name ``"uint8"`` will return type object
      :class:`~pywbem.Uint8`.
  
      For CIM data type names ``"string"`` and ``"char16"``, the
      :term:`unicode string` type is returned (Unicode strings are the preferred
      representation for these CIM data types).
  
      The returned type can be used as a constructor from a differently typed
      input value in many cases. Notable limitations are:
  
      * In Python 3, the :class:`py3:str` type is used to represent CIM string
        data types. When constructing such an object from a byte string, the
        resulting string is not a unicode-translated version of the byte string
        as one would assume (and as is the case in Python 2), but instead that
        results in a unicode string that is a `repr()` representation of the
        byte string::
  
            string_type = type_from_name('string')  # str
            s1 = b'abc'
            s2 = string_type(s1)  # results in u"b'abc'", and not in u"abc"
  
        Use `decode()` and `encode()` for strings instead of type conversion
        syntax (in both Python 2 and 3, for consistency).
  
      Parameters:
  
        type_name (:term:`string`):
          The simple (=non-array) CIM data type name (e.g. ``"uint8"`` or
          ``"reference"``).
  
      Returns:
  
          The Python type object for the CIM data type (e.g.
          :class:`~pywbem.Uint8` or :class:`~pywbem.CIMInstanceName`).
  
      Raises:
  
          ValueError: Unknown CIM data type name.