'Returns data for the path to the block in the course graph.
Note: In case of multiple paths to the block from the course
root, this function returns a path arbitrarily but consistently,
depending on the modulestore. In the future, we may want to
extend it to check which of the paths, the user has access to
and return its data.
Arguments:
block (XBlock): The block whose path is required.
Returns:
list of PathItems'

@staticmethod
def get_path(usage_key):

    with modulestore().bulk_operations(usage_key.course_key):
        try:
            path = search.path_to_location(modulestore(), usage_key, full_path=True)
        except ItemNotFoundError:
            log.error(u'Block    with    usage_key:    %s    not    found.', usage_key)
            return []
        except NoPathToItem:
            log.error(u'No    path    to    block    with    usage_key:    %s.', usage_key)
            return []
        path_data = []
        for ancestor_usage_key in path:
            if ((ancestor_usage_key != usage_key) and (ancestor_usage_key.block_type != 'course')):
                try:
                    block = modulestore().get_item(ancestor_usage_key)
                except ItemNotFoundError:
                    return []
                path_data.append(PathItem(usage_key=block.location, display_name=block.display_name_with_default))
    return path_data
