code: def unpack_numeric(self, data, cimtype):
          
  
          if data is None:
              return None
  
          # DSP0201 defines numeric values to be whitespace-tolerant
          data = data.strip()
  
          # Decode the CIM-XML string representation into a Python number
          #
          # Some notes:
          # * For integer numbers, only decimal and hexadecimal strings are
          #   allowed - no binary or octal.
          # * In Python 2, int() automatically returns a long, if needed.
          # * For real values, DSP0201 defines a subset of the syntax supported
          #   by Python float(), including the special states Inf, -Inf, NaN. The
          #   only known difference is that DSP0201 requires a digit after the
          #   decimal dot, while Python does not.
          if CIMXML_HEX_PATTERN.match(data):
              value = int(data, 16)
          else:
              try:
                  value = int(data)
              except ValueError:
                  try:
                      value = float(data)
                  except ValueError:
                      raise CIMXMLParseError(
                          _format("Invalid numeric value {0!A}", data),
                          conn_id=self.conn_id)
  
          # Convert the Python number into a CIM data type
          if cimtype is None:
              return value  # int/long or float (used for keybindings)
  
          # The caller ensured a numeric type for cimtype
          CIMType = type_from_name(cimtype)
          try:
              value = CIMType(value)
          except ValueError as exc:
              raise CIMXMLParseError(
                  _format("Cannot convert value {0!A} to numeric CIM type {1}",
                          exc, CIMType),
                  conn_id=self.conn_id)
          return value
docs: Unpack a string value of a numeric CIM type and return its CIM data
          type object, or None.
  
          data (unicode string): CIM-XML string value, or None (in which case
            None is returned).
  
          cimtype (string): CIM data type name (e.g. 'uint8'), or None (in which
            case the value is returned as a Python int/long or float).