function to read pickle