'Imports a shared workflow'

def _import_shared_workflow(self, trans, stored):

    imported_stored = model.StoredWorkflow()
    imported_stored.name = ('imported:    ' + stored.name)
    workflow = stored.latest_workflow.copy()
    workflow.stored_workflow = imported_stored
    imported_stored.latest_workflow = workflow
    imported_stored.user = trans.user
    session = trans.sa_session
    session.add(imported_stored)
    session.flush()
    self.copy_item_annotation(session, stored.user, stored, imported_stored.user, imported_stored)
    for (order_index, step) in enumerate(stored.latest_workflow.steps):
        self.copy_item_annotation(session, stored.user, step, imported_stored.user, imported_stored.latest_workflow.steps[order_index])
    session.flush()
    return imported_stored
