unpickler: refactor and reduce complexity

Break _restore() up into small single-page functions and
refactor it so that there is only a single exit point.

Signed-off-by: David Aguilar <davvid@gmail.com>