def with_parent(instance, prop):
 if isinstance(prop, util.string_types):
  mapper = object_mapper(instance)
  prop = getattr(mapper.class_, prop).property
 elif isinstance(prop, attributes.QueryableAttribute):
  prop = prop.property
 return prop._with_parent(instance)

def with_parent ( instance , prop ) : if isinstance ( prop , util . string_types ) : mapper = object_mapper ( instance ) prop = getattr ( mapper . class_ , prop ) . property elif isinstance ( prop , attributes . QueryableAttribute ) : prop = prop . property return prop . _with_parent ( instance )
create filtering criterion that relates this querys primary entity to the given related instance .