human
Complete this python program:
def decodeHexValue(value, raw=False):
assistant
#Here is the Python program you requested.

    """Returns value decoded from DBMS specific hexadecimal representation
    >>> decodeHexValue(\3132332031\)
    u\123 1\
    >>> decodeHexValue([\0x31\, \0x32\])
    [u\1\, u\2\]
    """
    retVal = value
    def _(value):
        retVal = value
        if (value and isinstance(value, basestring)):
            if ((len(value) % 2) != 0):
                retVal = (('%s?' % hexdecode(value[:(-1)])) if (len(value) > 1) else value)
                singleTimeWarnMessage(("there    was    a    problem    decoding    value    '%s'    from    expected    hexadecimal    form" % value))
            else:
                retVal = hexdecode(value)
            if ((not kb.binaryField) and (not raw)):
                if (Backend.isDbms(DBMS.MSSQL) and value.startswith('0x')):
                    try:
                        retVal = retVal.decode('utf-16-le')
                    except UnicodeDecodeError:
                        pass
                elif Backend.isDbms(DBMS.HSQLDB):
                    try:
                        retVal = retVal.decode('utf-16-be')
                    except UnicodeDecodeError:
                        pass
                if (not isinstance(retVal, unicode)):
                    retVal = getUnicode(retVal, 'utf8')
        return retVal
    try:
        retVal = applyFunctionRecursively(value, _)
    except:
        singleTimeWarnMessage(("there    was    a    problem    decoding    value    '%s'    from    expected    hexadecimal    form" % value))
    return retVal