def METHOD_NAME(
    dock_widgets: Sequence[Widget], size: Size, viewport: Size
) -> tuple[list[WidgetPlacement], Spacing]:
    """Arrange widgets which are *docked*.
    Args:
        dock_widgets: Widgets with a non-empty dock.
        size: Size of the container.
        viewport: Size of the viewport.
    Returns:
        A tuple of widget placements, and additional spacing around them
    """
    _WidgetPlacement = WidgetPlacement
    top_z = TOP_Z
    width, height = size
    null_spacing = Spacing()
    top = right = bottom = left = 0
    placements: list[WidgetPlacement] = []
    append_placement = placements.append
    for dock_widget in dock_widgets:
        edge = dock_widget.styles.dock
        box_model = dock_widget._get_box_model(
            size, viewport, Fraction(size.width), Fraction(size.height)
        )
        widget_width_fraction, widget_height_fraction, margin = box_model
        widget_width = int(widget_width_fraction) + margin.width
        widget_height = int(widget_height_fraction) + margin.height
        if edge == "bottom":
            dock_region = Region(0, height - widget_height, widget_width, widget_height)
            bottom = max(bottom, widget_height)
        elif edge == "top":
            dock_region = Region(0, 0, widget_width, widget_height)
            top = max(top, widget_height)
        elif edge == "left":
            dock_region = Region(0, 0, widget_width, widget_height)
            left = max(left, widget_width)
        elif edge == "right":
            dock_region = Region(width - widget_width, 0, widget_width, widget_height)
            right = max(right, widget_width)
        else:
            # Should not occur, mainly to keep Mypy happy
            raise AssertionError("invalid value for edge")  # pragma: no-cover
        align_offset = dock_widget.styles._align_size(
            (widget_width, widget_height), size
        )
        dock_region = dock_region.shrink(margin).translate(align_offset)
        append_placement(
            _WidgetPlacement(dock_region, null_spacing, dock_widget, top_z, True)
        )
    dock_spacing = Spacing(top, right, bottom, left)
    return (placements, dock_spacing)