Revert "Merge pull request #408 from damianavila/fix_shelve"

This reverts commit 95642581a9b30703e75056c2b1f1fc11bd174f3a, reversing
changes made to b1023b0e0b1865f70efe9bd2c04d746356f9081b.

I found some problems with py3 compatibility in the current implementation and in master without this PR merged, so we need to fix the previous errors first before trying to fix this one.