'This takes a file-like object for reading a pickle data stream.
The protocol version of the pickle is detected automatically, so no
proto argument is needed.
The file-like object must have two methods, a read() method that
takes an integer argument, and a readline() method that requires no
arguments.  Both methods should return a string.  Thus file-like
object can be a file object opened for reading, a StringIO object,
or any other custom object that meets this interface.'

def __init__(self, file):

    self.readline = file.readline
    self.read = file.read
    self.memo = {}
