'Indicate that all response data has been written to this L{Request}.'

def finish(self):

    if self._disconnected:
        raise RuntimeError('Request.finish    called    on    a    request    after    its    connection    was    lost;    use    Request.notifyFinish    to    keep    track    of    this.')
    if self.finished:
        warnings.warn('Warning!    request.finish    called    twice.', stacklevel=2)
        return
    if (not self.startedWriting):
        self.write('')
    if self.chunked:
        self.channel.write('0\r\n\r\n')
    if (hasattr(self.channel, 'factory') and (self.channel.factory is not None)):
        self.channel.factory.log(self)
    self.finished = 1
    if (not self.queued):
        self._cleanup()
