unpickler: use isinstance() and trim trailing whitespace

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