'Delete the given item from persistence. kwargs allow modulestore specific parameters.
Args:
location: UsageKey of the item to be deleted
user_id: id of the user deleting the item
revision:
None - deletes the item and its subtree, and updates the parents per description above
ModuleStoreEnum.RevisionOption.published_only - removes only Published versions
ModuleStoreEnum.RevisionOption.all - removes both Draft and Published parents
currently only provided by contentstore.views.item.orphan_handler
Otherwise, raises a ValueError.'

def delete_item(self, location, user_id, revision=None, skip_auto_publish=False, **kwargs):

    allowed_revisions = [None, ModuleStoreEnum.RevisionOption.published_only, ModuleStoreEnum.RevisionOption.all]
    if (revision not in allowed_revisions):
        raise UnsupportedRevisionError(allowed_revisions)
    autopublish_parent = False
    with self.bulk_operations(location.course_key):
        if isinstance(location, LibraryUsageLocator):
            branches_to_delete = [ModuleStoreEnum.BranchName.library]
        elif (location.category in DIRECT_ONLY_CATEGORIES):
            branches_to_delete = [ModuleStoreEnum.BranchName.published, ModuleStoreEnum.BranchName.draft]
        elif (revision == ModuleStoreEnum.RevisionOption.all):
            branches_to_delete = [ModuleStoreEnum.BranchName.published, ModuleStoreEnum.BranchName.draft]
        elif (revision == ModuleStoreEnum.RevisionOption.published_only):
            branches_to_delete = [ModuleStoreEnum.BranchName.published]
        elif (revision is None):
            branches_to_delete = [ModuleStoreEnum.BranchName.draft]
            parent_loc = self.get_parent_location(location.for_branch(ModuleStoreEnum.BranchName.draft))
            autopublish_parent = ((not skip_auto_publish) and (parent_loc is not None) and (parent_loc.block_type in DIRECT_ONLY_CATEGORIES))
        self._flag_publish_event(location.course_key)
        for branch in branches_to_delete:
            branched_location = location.for_branch(branch)
            super(DraftVersioningModuleStore, self).delete_item(branched_location, user_id)
        if autopublish_parent:
            self.publish(parent_loc.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs)
