generalize chain to allow any iterable of iterables