def METHOD_NAME(self, metadata: Metadata) -> str:
    title = metadata.get("type")
    if title is not None:
        value = metadata.get("value")
        if value:
            title += f": {truncatechars(value.splitlines()[0], 100)}"
    # If there's no value for display_title_with_tree_label, or if the
    # value is None, we should show the tree labels anyway since it's an
    # old event.
    if metadata.get("display_title_with_tree_label") in (None, True):
        return compute_title_with_tree_label(title, metadata)
    return title or metadata.get("function") or "<unknown>"