! @brief Return a list containing CmsisPackRef objects for all installed packs.

def get_installed_packs(cache=None):
        """! @brief Return a list containing CmsisPackRef objects for all installed packs."""
        try:
            cache = cache or cmsis_pack_manager.Cache(True, True)
            results = []
            # packs_for_devices() returns only unique packs.
            for pack in cache.packs_for_devices(cache.index.values()):
                pack_path = os.path.join(cache.data_path, pack.get_pack_name())
                if os.path.isfile(pack_path):
                    results.append(pack)
            return results
        except FileNotFoundError:
            # cmsis-pack-manage can raise this exception if the cache is empty.
            return []