(cls, raw_message)
return cls(
            username=str(data['username']),
            text=str(data['text']),
            display_name=str(data['display_name'])
        )
Returns instance of Message or raises ValueError
        If message have incorrect format.
Returns instance of Message or raises ValueError
        If message have incorrect format.
Returns instance of Message or raises ValueError If message have incorrect format .
def from_string(cls, raw_message):
        """
        Returns instance of Message or raises ValueError
        If message have incorrect format.
        """
        data = json.loads(raw_message)
        if set(data.keys()) != {'username', 'text', 'display_name'}:
            raise ValueError('Invalid message format given')
        return cls(
            username=str(data['username']),
            text=str(data['text']),
            display_name=str(data['display_name'])
        )
def from_string ( cls , raw_message ) : data = json . loads ( raw_message ) if set ( data . keys ( ) ) != { 'username' , 'text' , 'display_name' } : raise ValueError ( 'Invalid message format given' ) return cls ( username = str ( data [ 'username' ] ) , text = str ( data [ 'text' ] ) , display_name = str ( data [ 'display_name' ] ) )