'Returns the given location\'s parent location in this course.
Returns: version agnostic locations (revision always None) as per the rest of mongo.
Args:
revision:
None - uses the branch setting for the revision
ModuleStoreEnum.RevisionOption.published_only
- return only the PUBLISHED parent if it exists, else returns None
ModuleStoreEnum.RevisionOption.draft_preferred
- return either the DRAFT or PUBLISHED parent, preferring DRAFT, if parent(s) exists,
else returns None
If the draft has a different parent than the published, it returns only
the draft\'s parent. Because parents don\'t record their children\'s revisions, this
is actually a potentially fragile deduction based on parent type. If the parent type
is not DIRECT_ONLY, then the parent revision must be DRAFT.
Only xml_exporter currently uses this argument. Others should avoid it.'

def get_parent_location(self, location, revision=None, **kwargs):

    if (revision is None):
        revision = (ModuleStoreEnum.RevisionOption.published_only if (self.get_branch_setting() == ModuleStoreEnum.Branch.published_only) else ModuleStoreEnum.RevisionOption.draft_preferred)
    return super(DraftModuleStore, self).get_parent_location(location, revision, **kwargs)
