def _sniffnfix_pg9_hex(value):
 try:
  if (value[0] == 'x'):
   return binascii.unhexlify(value[1:])
  elif value.startswith('\\x'):
   return binascii.unhexlify(value[2:])
  else:
   return value
 except Exception:
  return value

def _sniffnfix_pg9_hex ( value ) : try : if ( value [ 0 ] == 'x' ) : return binascii . unhexlify ( value [ 1 : ] ) elif value . startswith ( '\\x' ) : return binascii . unhexlify ( value [ 2 : ] ) else : return value except Exception : return value
sniff for and fix postgres 9 hex decoding issue .