code: def get_session():
      
      if hasattr(g, 'session'):
          return g.session
      sess = create_session(bind=current_app.config['DATABASE_ENGINE'])
      try:
          g.session = sess
      except RuntimeError:
          pass
      return sess
docs: Gets a session.  If there's no yet, creates one.
  
      :returns: a session