def adjust(box, outer, width, left=True, right=True):
    """Respect min/max and adjust width depending on ``outer``.

    If ``outer`` is set to ``True``, return margin width, else return content
    width.

    """
    fixed = min_max(box, width)

    if outer:
        return margin_width(box, fixed, left, right)
    else:
        return fixed
Respect min/max and adjust width depending on ``outer``.

If ``outer`` is set to ``True``, return margin width, else return content
width.
weasyprint/layout/preferred.py