def METHOD_NAME(
    buf: Sequence[str],
    ref: Sequence[str],
    start: int,
    end: int,
    formatter: Optional[Callable[[str], str]] = None,
    dashed: bool = False,
    ascii_only: Optional[bool] = None,
):
    """
    Draw an edge by adding Unicode box and arrow glyphs to beginning of each line in a list of lines.
    :param buf: Output buffer, used to render formatted edges.
    :param ref: Reference buffer, used to calculate edge depth.
    :param start: Start line.
    :param end: End line, where arrow points.
    :param formatter: Optional callback function used to format the edge before writing it to output buffer.
    :param dashed: Render edge line dashed instead of solid.
    :param ascii_only: Render edge using ASCII characters only. If unspecified, guess by stdout encoding.
    :return:
    """
    abs_start = min(start, end)
    abs_end = max(start, end)
    max_depth = max(map(len, ref[abs_start : abs_end + 1]))
    descending = start < end
    if ascii_only is None:
        # Guess whether we should only use ASCII characters based on stdout encoding
        ascii_only = getattr(sys.stdout, "encoding", None) != "utf-8"
    if ascii_only:
        chars = {
            "start_cap": "-",
            "start_corner": "+",
            "end_cap": ">",
            "end_corner": "+",
            "horizontal": "+" if dashed else "-",
            "vertical": "+" if dashed else "|",
            "spin": "@ ",
        }
    else:
        chars = {
            "start_cap": "╴",
            "start_corner": "╭" if descending else "╰",
            "end_cap": "▸",
            "end_corner": "╰" if descending else "╭",
            "horizontal": "╌" if dashed else "─",
            "vertical": "╎" if dashed else "│",
            "spin": "⟳ ",
        }
    def handle_line(i, edge_str):
        if formatter is not None:
            edge_str = formatter(edge_str)
        buf[i] = edge_str + buf[i]
    if start == end:
        handle_line(start, chars["spin"])
    else:
        handle_line(
            start, (chars["start_corner"] + chars["horizontal"] * (max_depth - len(ref[start])) + chars["start_cap"])
        )
        handle_line(end, (chars["end_corner"] + chars["horizontal"] * (max_depth - len(ref[end])) + chars["end_cap"]))
        for i in range(abs_start + 1, abs_end):
            handle_line(i, chars["vertical"] + " " * (1 + max_depth - len(ref[i])))