def METHOD_NAME(
    pum: PumDisplay,
    label_width: int,
    kind_dead_width: int,
    ellipsis_width: int,
    truncate: int,
    max_width: int,
    metric: Metric,
) -> VimCompletion:
    (kl, kr), (sl, sr) = pum.kind_context, pum.source_context
    kind = f"{kl}{metric.comp.kind}{kr}" if metric.comp.kind else ""
    label_width = metric.label_width
    kind_width = metric.kind_width + kind_dead_width
    tr = truncate - kind_width
    if (kind_width + ellipsis_width + pum.x_truncate_len) > truncate:
        truncated = metric.comp.label[: max(1, truncate - ellipsis_width)]
        label_lhs = (
            truncated + pum.ellipsis if truncated != metric.comp.label else truncated
        )
        abbr = label_lhs
    elif label_width > tr:
        label_lhs = metric.comp.label[: tr - ellipsis_width] + pum.ellipsis
        abbr = label_lhs + kind
    else:
        truncated_to = min(max_width + kind_dead_width, truncate) - kind_width
        label_lhs = metric.comp.label + (truncated_to - label_width) * " "
        abbr = label_lhs + kind
    menu = f"{sl}{metric.comp.source}{sr}"
    vcmp = VimCompletion(abbr=abbr, menu=menu, user_data=metric.comp.uid)
    return vcmp