'return a class property which produces a :class:`.Query` object
against the class and the current :class:`.Session` when called.
e.g.::
Session = scoped_session(sessionmaker())
class MyClass(object):
query = Session.query_property()
# after mappers are defined
result = MyClass.query.filter(MyClass.name==\'foo\').all()
Produces instances of the session\'s configured query class by
default.  To override and use a custom implementation, provide
a ``query_cls`` callable.  The callable will be invoked with
the class\'s mapper as a positional argument and a session
keyword argument.
There is no limit to the number of query properties placed on
a class.'

def query_property(self, query_cls=None):

    class query(object, ):
        def __get__(s, instance, owner):
            try:
                mapper = class_mapper(owner)
                if mapper:
                    if query_cls:
                        return query_cls(mapper, session=self.registry())
                    else:
                        return self.registry().query(mapper)
            except orm_exc.UnmappedClassError:
                return None
    return query()
