'Emits LLVM code to ensure the `envptr` is not NULL'

def emit_environment_sentry(self, envptr, return_pyobject=False):

    is_null = cgutils.is_null(self.builder, envptr)
    with cgutils.if_unlikely(self.builder, is_null):
        if return_pyobject:
            fnty = self.builder.function.type.pointee
            assert (fnty.return_type == self.pyobj)
            self.err_set_string('PyExc_RuntimeError', 'missing    Environment')
            self.builder.ret(self.get_null_object())
        else:
            self.context.call_conv.return_user_exc(self.builder, RuntimeError, ('missing    Environment',))
