@with_session
def search_by_field_values(field_value_list, task_name, local=False, session=None):
 found = session.query(SeenField).join(SeenEntry).filter(SeenField.value.in_(field_value_list))
 if local:
  found = found.filter((SeenEntry.task == task_name))
 else:
  found = found.filter(or_((SeenEntry.local == False), (SeenEntry.local == None)))
 return found.first()

@ with_session def search_by_field_values ( field_value_list , task_name , local = False , session = None ) : found = session . query ( SeenField ) . join ( SeenEntry ) . filter ( SeenField . value . in_ ( field_value_list ) ) if local : found = found . filter ( ( SeenEntry . task == task_name ) ) else : found = found . filter ( or_ ( ( SeenEntry . local == False ) , ( SeenEntry . local == None ) ) ) return found . first ( )
return a seenentry instance if it matches field values .