Manipulating PDF files in Python, and fun with itertools

I have access to a scanner that can scan multiple pages, but does not have a duplexer. So to scan double-sided, I need to feed in the pages face up, scan them, then turn the pages face-down and scan again. Thus I need to interleave the pages from the two …