Returns a named set ORM object given an instance or name as string
if isinstance(instance_or_name, str):
x = session.query(set_class).filter(set_class.name == instance_or_name).first()
return x if x is not None else set_class(name=instance_or_name)
elif isinstance(instance_or_name, set_class):
return instance_or_name
else:
return ValueError("%s-type required" % set_class.__class__)