def is_all_type(t, ttype): """ Helper to check if given 't' is a 'ttype' or list of 'ttype' """ tlist = lambda l: all(map(lambda t: isinstance(t, ttype), l)) return isinstance(t, ttype) or tlist(t)