[types] Add typing to doctools/util.py