lib: generalize dictionaries