'Delete snapshot images that are marked for removal from the backend.
This method will iterate over all snapshots (beginning with the
oldest), that are defined on the same snapshot group as the provided
snapshot image. If the snapshot is marked for deletion, it will be
purged from the backend. Otherwise, the method will return because
no further snapshots can be purged.
The bitset will be updated based on the return from this method.
Any updates to the index will be provided as a dict, and any keys
to be removed from the index should be returned as (dict, list).
:param images: a list of E-Series snapshot images
:param bitset: a bitset representing the snapshot images that are
no longer needed on the backend (and may be deleted when possible)
:return (dict, list): a tuple containing a dict of updates for the
index and a list of keys to remove from the index'

def _cleanup_snapshot_images(self, images, bitset):

    snap_grp_ref = images[0]['pitGroupRef']
    if (bitset == ((2 ** len(images)) - 1)):
        try:
            self._delete_snapshot_group(snap_grp_ref)
        except exception.NetAppDriverException as e:
            LOG.warning('Unable    to    remove    snapshot    group    -    %s.', e.msg)
        return (None, [snap_grp_ref])
    else:
        snapshots = sorted(images, key=(lambda x: x['pitSequenceNumber']))
        deleted = 0
        for (i, snapshot) in enumerate(snapshots):
            if bitset.is_set(i):
                self._delete_snapshot_image(snapshot)
                deleted += 1
            else:
                break
        if deleted:
            bitset >>= deleted
            LOG.debug('Deleted    %(count)s    snapshot    images    from    snapshot    group:    %(grp)s.', {'count': deleted, 'grp': snap_grp_ref})
            if (deleted >= len(images)):
                try:
                    self._delete_snapshot_group(snap_grp_ref)
                except exception.NetAppDriverException as e:
                    LOG.warning('Unable    to    remove    snapshot    group    -    %s.', e.msg)
                return (None, [snap_grp_ref])
        return ({snap_grp_ref: repr(bitset)}, None)
