@staticmethod<EOL><INDENT>def from_conversation_event(conversation, conv_event, prev_conv_event,<EOL>datetimefmt, watermark_users=None):<DEDENT>
user = conversation.get_user(conv_event.user_id)<EOL>if prev_conv_event is not None:<EOL><INDENT>is_new_day = (conv_event.timestamp.astimezone(tz=None).date() !=<EOL>prev_conv_event.timestamp.astimezone(tz=None).date())<EOL><DEDENT>else:<EOL><INDENT>is_new_day = False<EOL><DEDENT>if isinstance(conv_event, hangups.ChatMessageEvent):<EOL><INDENT>return MessageWidget(conv_event.timestamp, conv_event.text,<EOL>datetimefmt, user, show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>elif isinstance(conv_event, hangups.RenameEvent):<EOL><INDENT>if conv_event.new_name == '<STR_LIT>':<EOL><INDENT>text = ('<STR_LIT>'<EOL>.format(user.first_name))<EOL><DEDENT>else:<EOL><INDENT>text = ('<STR_LIT>'<EOL>.format(user.first_name, conv_event.new_name))<EOL><DEDENT>return MessageWidget(conv_event.timestamp, text, datetimefmt,<EOL>show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>elif isinstance(conv_event, hangups.MembershipChangeEvent):<EOL><INDENT>event_users = [conversation.get_user(user_id) for user_id<EOL>in conv_event.participant_ids]<EOL>names = '<STR_LIT:U+002CU+0020>'.join([user.full_name for user in event_users])<EOL>if conv_event.type_ == hangups.MEMBERSHIP_CHANGE_TYPE_JOIN:<EOL><INDENT>text = ('<STR_LIT>'<EOL>.format(user.first_name, names))<EOL><DEDENT>else:  <EOL><INDENT>text = ('<STR_LIT>'.format(names))<EOL><DEDENT>return MessageWidget(conv_event.timestamp, text, datetimefmt,<EOL>show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>elif isinstance(conv_event, hangups.HangoutEvent):<EOL><INDENT>text = {<EOL>hangups.HANGOUT_EVENT_TYPE_START: (<EOL>'<STR_LIT>'<EOL>),<EOL>hangups.HANGOUT_EVENT_TYPE_END: (<EOL>'<STR_LIT>'<EOL>),<EOL>hangups.HANGOUT_EVENT_TYPE_ONGOING: (<EOL>'<STR_LIT>'<EOL>),<EOL>}.get(conv_event.event_type, '<STR_LIT>')<EOL>return MessageWidget(conv_event.timestamp, text, datetimefmt,<EOL>show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>elif isinstance(conv_event, hangups.GroupLinkSharingModificationEvent):<EOL><INDENT>status_on = hangups.GROUP_LINK_SHARING_STATUS_ON<EOL>status_text = ('<STR_LIT>' if conv_event.new_status == status_on<EOL>else '<STR_LIT>')<EOL>text = '<STR_LIT>'.format(user.first_name,<EOL>status_text)<EOL>return MessageWidget(conv_event.timestamp, text, datetimefmt,<EOL>show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>else:<EOL><INDENT>text = '<STR_LIT>'<EOL>return MessageWidget(conv_event.timestamp, text, datetimefmt,<EOL>show_date=is_new_day,<EOL>watermark_users=watermark_users)<EOL><DEDENT>
Return MessageWidget representing a ConversationEvent.

        Returns None if the ConversationEvent does not have a widget
        representation.