def get_conv_name(conv, truncate=False, show_unread=False):
num_unread = len([conv_event for conv_event in conv.unread_events if<EOL>isinstance(conv_event, hangups.ChatMessageEvent) and<EOL>not conv.get_user(conv_event.user_id).is_self])<EOL>if show_unread and num_unread > <NUM_LIT:0>:<EOL><INDENT>postfix = '<STR_LIT>'.format(num_unread)<EOL><DEDENT>else:<EOL><INDENT>postfix = '<STR_LIT>'<EOL><DEDENT>if conv.name is not None:<EOL><INDENT>return conv.name + postfix<EOL><DEDENT>else:<EOL><INDENT>participants = sorted(<EOL>(user for user in conv.users if not user.is_self),<EOL>key=lambda user: user.id_<EOL>)<EOL>names = [user.first_name for user in participants]<EOL>if not participants:<EOL><INDENT>return "<STR_LIT>" + postfix<EOL><DEDENT>if len(participants) == <NUM_LIT:1>:<EOL><INDENT>return participants[<NUM_LIT:0>].full_name + postfix<EOL><DEDENT>elif truncate and len(participants) > <NUM_LIT:2>:<EOL><INDENT>return ('<STR_LIT:U+002CU+0020>'.join(names[:<NUM_LIT:2>] + ['<STR_LIT>'.format(len(names) - <NUM_LIT:2>)]) +<EOL>postfix)<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT:U+002CU+0020>'.join(names) + postfix<EOL><DEDENT><DEDENT>
Return a readable name for a conversation.

    If the conversation has a custom name, use the custom name. Otherwise, for
    one-to-one conversations, the name is the full name of the other user. For
    group conversations, the name is a comma-separated list of first names. If
    the group conversation is empty, the name is "Empty Conversation".

    If truncate is true, only show up to two names in a group conversation.

    If show_unread is True, if there are unread chat messages, show the number
    of unread chat messages in parentheses after the conversation name.