'Write a simple response back to the client.'

def simple_response(self, status, msg=''):

    status = str(status)
    buf = [('%s    %s\r\n' % (self.environ['ACTUAL_SERVER_PROTOCOL'], status)), ('Content-Length:    %s\r\n' % len(msg)), 'Content-Type:    text/plain\r\n']
    if ((status[:3] == '413') and (self.response_protocol == 'HTTP/1.1')):
        self.close_connection = True
        buf.append('Connection:    close\r\n')
    buf.append('\r\n')
    if msg:
        buf.append(msg)
    try:
        self.wfile.sendall(''.join(buf))
    except socket.error as x:
        if (x.args[0] not in socket_errors_to_ignore):
            raise
