def sort_publications(pubs):
    """Sort a list of publications by repository version.

    Higher repository versions are listed first.
    """
    def key(pub):
        # Format: /pulp/api/v3/repositories/rpm/rpm/<repo UUID>/versions/<version>/
        rv = pub["repository_version"]
        return int(rv.split("/")[-2])

    return sorted(pubs, key=key, reverse=True)