def db_convert_text(value: object) -> str:
    """Convert from python object to postgresql TEXT"""
    if value is None:
        result = 'NULL'
    elif value:
        result = str(value)
        result = result.replace('\'', '\'\'')
        result = f'\'{result}\''
    else:
        result = ''
    return result