from typing import Optional


def get_extent_2d(shape, spacing: Optional[float] = None):
    """2D extent

    Args:
        shape: shape of the elements to plot
        spacing: spacing between grid points (assumed to be isotropic)

    Returns:
        The extent in 2D.

    """
    return (0, shape[0] * spacing, 0, shape[1] * spacing) if spacing else (0, shape[0], 0, shape[1])