def ensuremod(_larch, modname=None):
    """ensure that a group exists"""
    if _larch is not None:
        symtable = _larch.symtable
        if modname is not None and not symtable.has_group(modname):
            symtable.newgroup(modname)
        return symtable
