def deserialize_value(ty, value):
    '''
    Deserialize a value of some type
    '''
    uty = ty.upper()
    
    if uty == 'BOOLEAN':
        if value.isdigit():
            return bool(int(value))
        elif value.upper() == 'FALSE':
            return False
        elif value.upper() == 'TRUE':
            return True
        else:
            return None
    
    elif uty == 'INTEGER': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
    
    elif uty == 'REAL': 
        return float(value)
    
    elif uty == 'STRING': 
        return value[1:-1].replace("''", "'")
    
    elif uty == 'UNIQUE_ID': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
Deserialize a value of some type