'Internal method used to convert the utf-8 encoded bytestring into
unicode.
If the conversion fails, the socket will be closed.'

def _decode_bytes(self, bytestring):

    if (not bytestring):
        return ''
    try:
        return bytestring.decode('utf-8')
    except UnicodeDecodeError:
        self.close(1007)
        raise
