def _preprocess_data(self, data):
if hasattr(data, '<STR_LIT>') and not self.chunksize:<EOL><INDENT>data = data.read()<EOL><DEDENT>if not hasattr(data, '<STR_LIT>') and self.chunksize:<EOL><INDENT>data = StringIO(data)<EOL><DEDENT>return data<EOL>
At this point, the data either has a `read` attribute (e.g. a file
object or a StringIO) or is a string that is a JSON document.

If self.chunksize, we prepare the data for the `__next__` method.
Otherwise, we read it into memory for the `read` method.