def vstack(
        cls,
        diagrams: Sequence[cirq.TextDiagramDrawer],
        padding_resolver: Callable[[Sequence[int | None]], int] | None = None,
    ):
        """Vertically stack text diagrams.

        Args:
            diagrams: The diagrams to stack, ordered from bottom to top.
            padding_resolver: A function that takes a list of paddings
                specified for a column and returns the padding to use in the
                stacked diagram. If None, defaults to raising ValueError if the
                diagrams to stack contain inconsistent padding in any column,
                including if some specify a padding and others don't.

        Raises:
            ValueError: Inconsistent padding cannot be resolved.

        Returns:
            The vertically stacked diagram.
        """

        if padding_resolver is None:
            padding_resolver = _same_element_or_throw_error

        stacked = cls()
        dy = 0
        for diagram in diagrams:
            stacked.superimpose(diagram.shifted(dy=dy))
            dy += diagram.height()
        for x in stacked.horizontal_padding:
            resolved_padding = padding_resolver(
                tuple(cast(int | None, diagram.horizontal_padding.get(x)) for diagram in diagrams)
            )
            if resolved_padding is not None:
                stacked.horizontal_padding[x] = resolved_padding
        return stacked
Vertically stack text diagrams.

        Args:
            diagrams: The diagrams to stack, ordered from bottom to top.
            padding_resolver: A function that takes a list of paddings
                specified for a column and returns the padding to use in the
                stacked diagram. If None, defaults to raising ValueError if the
                diagrams to stack contain inconsistent padding in any column,
                including if some specify a padding and others don't.

        Raises:
            ValueError: Inconsistent padding cannot be resolved.

        Returns:
            The vertically stacked diagram.
        
cirq-core/cirq/circuits/text_diagram_drawer.py