def _normalize_sizes(sizes):
    """
    Checks whether all the sizes are either slices or not. Transforms
    slices into their sizes.
    """
    out = []
    ns = 0
    for size in sizes:
        if isinstance(size, slice):
            size = size.stop - size.start
            ns += 1

        else:
            size = int(size)

        out.append(size)

    if ns:
        if ns != len(sizes):
            raise ValueError('cannot mix sizes with slices! (%s)' % (sizes,))

        is_slice = True

    else:
        is_slice = False

    return out, is_slice