<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_keyvalue(self, tup_tree):
 """ Parse a KEYVALUE element and return the keybinding value as a CIM data type object, based upon the type information in its VALUETYPE and TYPE attributes, if present. If TYPE is specified, its value is used to create the corresponding CIM data type object. in this case, VALUETYPE is ignored and may be omitted. Discrepancies between TYPE and VALUETYPE are not checked. Note that DSP0201 does not detail how such discrepancies should be resolved, including the precedence of the DTD-defined default for VALUETYPE over a specified TYPE value. If TYPE is not specified but VALUETYPE is specified, the CIM type is defaulted for a VALUETYPE of 'string' and 'boolean'. For a VALUETYPE of 'numeric', the CIM type remains undetermined and the numeric values are returned as Python int/long or float objects. :: <!ELEMENT KEYVALUE (#PCDATA)> <!ATTLIST KEYVALUE VALUETYPE (string | boolean | numeric) "string" %CIMType; #IMPLIED> """


        self.check_node(tup_tree, 'KEYVALUE', (), ('VALUETYPE', 'TYPE'), (),
                        allow_pcdata=True)

        data = self.pcdata(tup_tree)
        attrl = attrs(tup_tree)

        valuetype = attrl.get('VALUETYPE', None)
        cimtype = attrl.get('TYPE', None)

        # Tolerate that some WBEM servers return TYPE="" instead of omitting
        # TYPE (e.g. the WBEM Solutions server).
        if cimtype == '':
            cimtype = None

        # Default the CIM type from VALUETYPE if not specified in TYPE
        if cimtype is None:
            if valuetype is None or valuetype == 'string':
                cimtype = 'string'
            elif valuetype == 'boolean':
                cimtype = 'boolean'
            elif valuetype == 'numeric':
                pass
            else:
                raise CIMXMLParseError(
                    _format("Element {0!A} has invalid 'VALUETYPE' attribute "
                            "value {1!A}", name(tup_tree), valuetype),
                    conn_id=self.conn_id)

        return self.unpack_single_value(data, cimtype)