def prep_for_like_query(self, x):
        from django.utils.encoding import smart_unicode
        # http://msdn2.microsoft.com/en-us/library/ms179859.aspx
        return smart_unicode(x).replace('\\', '\\\\').replace('[', '[[]').replace('%', '[%]').replace('_', '[_]')
Prepares a value for use in a LIKE query.
dataset/ETHPy150Open avidal/django-pyodbc/sql_server/pyodbc/operations.py/DatabaseOperations.prep_for_like_query