# Loaded on first use so we can print diagnostics before touching native BrainStem code.
brainstem = None
_BS_C = None


def load_brainstem():
    global brainstem, _BS_C
    if brainstem is not None:
        return brainstem
    import brainstem as _bs

    brainstem = _bs
    try:
        from brainstem import _BS_C as _c
        _BS_C = _c
    except ImportError:
        _BS_C = None
    return brainstem
