'Raise an error if the index is out of bounds.'

def guard_index(self, idx, msg):

    with self._builder.if_then(self.is_out_of_bounds(idx), likely=False):
        self._context.call_conv.return_user_exc(self._builder, IndexError, (msg,))
