<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def stream_array(self, generator):
        '''Helper function to stream content as an array of JSON values.'''
        def chunkify(generator):
            log.debug('Data Stream STARTED')
            yield '['.encode()
            # In order to have commas only after the first value, we take the
            # first value of the generator manually
            try:
                yield jsonify(next(generator)).encode()
            except StopIteration:
                pass
            while True:
                try:
                    bit = next(generator)
                except StopIteration:
                    yield ']'.encode()
                    break
                else:
                    yield ',\n'.encode()
                    yield jsonify(bit).encode()
            log.debug('Data Stream ENDED')
        return chunkify(generator)