Python Check If Substring Exists Sql Query To Find