def broadcast_dimension_size(
    variables: List[Variable],
) -> 'OrderedDict[Any, int]':
    """Extract dimension sizes from a dictionary of variables.

    Raises ValueError if any dimensions have different sizes.
    """
    dims = OrderedDict()  # type: OrderedDict[Any, int]
    for var in variables:
        for dim, size in zip(var.dims, var.shape):
            if dim in dims and size != dims[dim]:
                raise ValueError('index %r not aligned' % dim)
            dims[dim] = size
    return dims
Extract dimension sizes from a dictionary of variables.

    Raises ValueError if any dimensions have different sizes.