<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_partial(self, data):
 """Incrementally decodes JSON data sets into Python objects. Raises ------ ~ipfsapi.exceptions.DecodingError Returns ------- generator """

        try:
            # Python 3 requires all JSON data to be a text string
            lines = self._decoder1.decode(data, False).split("\n")

            # Add first input line to last buffer line, if applicable, to
            # handle cases where the JSON string has been chopped in half
            # at the network level due to streaming
            if len(self._buffer) > 0 and self._buffer[-1] is not None:
                self._buffer[-1] += lines[0]
                self._buffer.extend(lines[1:])
            else:
                self._buffer.extend(lines)
        except UnicodeDecodeError as error:
            raise exceptions.DecodingError('json', error)

        # Process data buffer
        index = 0
        try:
            # Process each line as separate buffer
            #PERF: This way the `.lstrip()` call becomes almost always a NOP
            #      even if it does return a different string it will only
            #      have to allocate a new buffer for the currently processed
            #      line.
            while index < len(self._buffer):
                while self._buffer[index]:
                    # Make sure buffer does not start with whitespace
                    #PERF: `.lstrip()` does not reallocate if the string does
                    #      not actually start with whitespace.
                    self._buffer[index] = self._buffer[index].lstrip()

                    # Handle case where the remainder of the line contained
                    # only whitespace
                    if not self._buffer[index]:
                        self._buffer[index] = None
                        continue

                    # Try decoding the partial data buffer and return results
                    # from this
                    data = self._buffer[index]
                    for index2 in range(index, len(self._buffer)):
                        # If decoding doesn't succeed with the currently
                        # selected buffer (very unlikely with our current
                        # class of input data) then retry with appending
                        # any other pending pieces of input data
                        # This will happen with JSON data that contains
                        # arbitrary new-lines: "{1:\n2,\n3:4}"
                        if index2 > index:
                            data += "\n" + self._buffer[index2]

                        try:
                            (obj, offset) = self._decoder2.raw_decode(data)
                        except ValueError:
                            # Treat error as fatal if we have already added
                            # the final buffer to the input
                            if (index2 + 1) == len(self._buffer):
                                raise
                        else:
                            index = index2
                            break

                    # Decoding succeeded – yield result and shorten buffer
                    yield obj
                    if offset < len(self._buffer[index]):
                        self._buffer[index] = self._buffer[index][offset:]
                    else:
                        self._buffer[index] = None
                index += 1
        except ValueError as error:
            # It is unfortunately not possible to reliably detect whether
            # parsing ended because of an error *within* the JSON string, or
            # an unexpected *end* of the JSON string.
            # We therefor have to assume that any error that occurs here
            # *might* be related to the JSON parser hitting EOF and therefor
            # have to postpone error reporting until `parse_finalize` is
            # called.
            self._lasterror = error
        finally:
            # Remove all processed buffers
            del self._buffer[0:index]