'Sends the closing frame to the client, if required.'

def _send_closing_frame(self, ignore_send_errors=False):

    if ((self.version in ['7', '8', '13']) and (not self.websocket_closed)):
        msg = ''
        (buf, h, t) = self.encode_hybi(msg, opcode=8, base64=False)
        self.socket.sendall(buf)
        self.websocket_closed = True
    elif ((self.version == 76) and (not self.websocket_closed)):
        try:
            self.socket.sendall('\xff\x00')
        except SocketError:
            if (not ignore_send_errors):
                raise
        self.websocket_closed = True
