def get_shape_from_dims(axis_0, axis_1=None):
    """
        Constructs a chain shape tuple from an array-like axis_0 and an optional array-like axis_1
    :param axis_0: Iterable of dimensions for the first leg on each site of the chain
    :param axis_1: Optional iterable of dimensions for the second leg on each site of the chain (of the same size
                   as axis_0)
    :return: chain shape tuple
    """
    if axis_1 is None:
        return tuple([(dim, )for dim in axis_0])
    else:
        assert len(axis_0) == len(axis_1)
        return tuple([(dim0, dim1) for dim0, dim1 in zip(axis_0, axis_1)])