code: def _infer_type(value, element_kind, element_name):
      
  
      if value is None:
          raise ValueError(
              _format("Cannot infer CIM type of {0} {1!A} from its value when "
                      "the value is None", element_kind, element_name))
  
      try:
          return cimtype(value)
      except TypeError as exc:
          raise ValueError(
              _format("Cannot infer CIM type of {0} {1!A} from its value: {2!A}",
                      element_kind, element_name, exc))
docs: Infer the CIM type name of the value, based upon its Python type.