'Helper to look up an app.'

def get_app(self, reference_app=None):

    if (reference_app is not None):
        return reference_app
    if (self.app is not None):
        return self.app
    ctx = _app_ctx_stack.top
    if (ctx is not None):
        return ctx.app
    raise RuntimeError('application    not    registered    on    rbac    instance    and    no    application    bound    to    current    context')
