import warnings instead of only warn
replace lambda by bool, to enable pickling of MealyMachines