def escape_like(value):
    """Escapes a string to be used as a plain string in LIKE"""
    escape_char = '\\'
    return (value
            .replace(escape_char, escape_char * 2)  # literal escape char needs to be escaped
            .replace('%', escape_char + '%')      # we don't want % wildcards inside the value
            .replace('_', escape_char + '_'))     # same for _ wildcards