if '*' in needle or '_' in needle:
    looking_for = needle.replace('_', '__').replace('*', '%').replace('?', '_')
else:
    looking_for = '%{0}%'.format(needle)
SQLAlchemy query where a column contains a substring