Gets a session.  If there's no yet, creates one.

    :returns: a session

def get_session():
    """Gets a session.  If there's no yet, creates one.

    :returns: a 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