'Ensure headers and content have both been sent'

def finish_content(self):

    if (not self.headers_sent):
        self.headers.setdefault('Content-Length', '0')
        self.send_headers()
    else:
        pass
