'Returns True if location exists in this ModuleStore.
Args:
revision:
ModuleStoreEnum.RevisionOption.published_only - checks for the published item only
ModuleStoreEnum.RevisionOption.draft_only - checks for the draft item only
None - uses the branch setting, as follows:
if branch setting is ModuleStoreEnum.Branch.published_only, checks for the published item only
if branch setting is ModuleStoreEnum.Branch.draft_preferred, checks whether draft or published item exists'

def has_item(self, usage_key, revision=None):

    def has_published():
        return super(DraftModuleStore, self).has_item(usage_key)
    def has_draft():
        return super(DraftModuleStore, self).has_item(as_draft(usage_key))
    if (revision == ModuleStoreEnum.RevisionOption.draft_only):
        return has_draft()
    elif ((revision == ModuleStoreEnum.RevisionOption.published_only) or (self.get_branch_setting() == ModuleStoreEnum.Branch.published_only)):
        return has_published()
    elif (revision is None):
        key = usage_key.to_deprecated_son(prefix='_id.')
        del key['_id.revision']
        return (self.collection.find(key).count() > 0)
    else:
        raise UnsupportedRevisionError()
