Python tools for merging iterables with boolean operators