document summary adapted from pyteaser