def tuple_operator_in(model_pk, ids):
 l = []
 for id in ids:
  k = []
  for i in range(len(model_pk)):
   k.append(eq(model_pk[i], id[i]))
  l.append(and_(*k))
 if (len(l) >= 1):
  return or_(*l)
 else:
  return None

def tuple_operator_in ( model_pk , ids ) : l = [ ] for id in ids : k = [ ] for i in range ( len ( model_pk ) ) : k . append ( eq ( model_pk [ i ] , id [ i ] ) ) l . append ( and_ ( * k ) ) if ( len ( l ) >= 1 ) : return or_ ( * l ) else : return None
the tuple_ operator only works on certain engines like mysql or postgresql .