def end_training():
    try:
        session = get_session()
    except ValueError:
        raise SGDBackendError('`finish_training` has been called before `start_training`. Please call `start_training` before `finish_training`.')
    try:
        output = session.finish()
    finally:
        shutdown_session()
    return output
def end_training():
    try:
        session = get_session()
    except ValueError:
        raise SGDBackendError('`finish_training` has been called before `start_training`. Please call `start_training` before `finish_training`.')
    try:
        output = session.finish()
    finally:
        shutdown_session()
    return output