def decodeHexValue(value, raw=False):
 retVal = value
 def _(value):
  retVal = value
  if (value and isinstance(value, basestring) and ((len(value) % 2) == 0)):
   retVal = hexdecode(retVal)
   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

def decodeHexValue ( value , raw = False ) : retVal = value def _ ( value ) : retVal = value if ( value and isinstance ( value , basestring ) and ( ( len ( value ) % 2 ) == 0 ) ) : retVal = hexdecode ( retVal ) 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
returns value decoded from dbms specific hexadecimal representation .