'Performance Note: This is generally a costly operation, but useful for wildcard searches.
Returns:
list of XModuleDescriptor instances for the matching items within the course with
the given course_key
NOTE: don\'t use this to look for courses as the course_key is required. Use get_courses instead.
Args:
course_key (CourseKey): the course identifier
revision:
ModuleStoreEnum.RevisionOption.published_only - returns only Published items
ModuleStoreEnum.RevisionOption.draft_only - returns only Draft items
None - uses the branch setting, as follows:
if the branch setting is ModuleStoreEnum.Branch.published_only,
returns only Published items
if the branch setting is ModuleStoreEnum.Branch.draft_preferred,
returns either Draft or Published, preferring Draft items.'

def get_items(self, course_key, revision=None, **kwargs):

    def base_get_items(key_revision):
        return super(DraftModuleStore, self).get_items(course_key, key_revision=key_revision, **kwargs)
    def draft_items():
        return [wrap_draft(item) for item in base_get_items(MongoRevisionKey.draft)]
    def published_items(draft_items):
        draft_items_locations = {item.location for item in draft_items}
        return [item for item in base_get_items(MongoRevisionKey.published) if (item.location not in draft_items_locations)]
    if (revision == ModuleStoreEnum.RevisionOption.draft_only):
        return draft_items()
    elif ((revision == ModuleStoreEnum.RevisionOption.published_only) or (self.get_branch_setting() == ModuleStoreEnum.Branch.published_only)):
        return published_items([])
    elif (revision is None):
        draft_items = draft_items()
        return (draft_items + published_items(draft_items))
    else:
        raise UnsupportedRevisionError()
