'Get a stored workflow from a encoded stored workflow id and
make sure it accessible to the user.'

def get_stored_accessible_workflow(self, trans, workflow_id):

    stored_workflow = self.get_stored_workflow(trans, workflow_id)
    if ((stored_workflow.user != trans.user) and (not trans.user_is_admin())):
        if (trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0):
            message = 'Workflow    is    not    owned    by    or    shared    with    current    user'
            raise exceptions.ItemAccessibilityException(message)
    return stored_workflow
