def escape_sql_like_special_characters(term, escape='\\'):
 for ch in (escape + _special_characters):
  term = term.replace(ch, (escape + ch))
 return term

def escape_sql_like_special_characters ( term , escape = '\\' ) : for ch in ( escape + _special_characters ) : term = term . replace ( ch , ( escape + ch ) ) return term
escapes characters that are special to the the sql like expression .