update get_parent_location method to select non-orphan parents from mult...

...iple parents

STUD-2007
could terminate when `ancestor_loc.category == 'course'` or `ancestor_loc is None`

For expediency, once you find an ancestor path terminating in 'course', I think you should return that parent and don't bother with the `ReferentialIntegrityError` at least in lms.