Python - Automated creation of ACC cloud links

This code returns Project and Model GUIDs of given Documents given as list.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

def get_cloud_model_info(doc):
    try:
        path = doc.GetCloudModelPath()
        mpat = ModelPathUtils.ConvertModelPathToUserVisiblePath(path)
        mguid = path.GetModelGUID()
        pguid = path.GetProjectGUID()
        return (path, mpat, mguid, pguid)
    except:
        # Skip if the document is not a cloud model
        return None

docs = IN[0]  # assuming this is a list of documents
output = [get_cloud_model_info(doc) for doc in docs if doc]

OUT = output

This code creates in current model links to a given ACC models.
Inputs -Project GUIDs- and list of -Model GUIDs-
Current project has to be a model on ACC within the same project that links will be.

import clr
import System
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
input_string = 'EMEA'
project_guid = System.Guid(IN[0])
model_guids = [System.Guid(guid) for guid in IN[1]]
linkOptions = RevitLinkOptions(False)

revitLinkInstances = []
try:
    TransactionManager.Instance.EnsureInTransaction(doc)
    for model_guid in model_guids:
        cloudPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(input_string, project_guid, model_guid)
        mpat = ModelPathUtils.ConvertModelPathToUserVisiblePath(cloudPath)
        revitLinkType = RevitLinkType.Create(doc, cloudPath, linkOptions)
        revitLinkInstance = RevitLinkInstance.Create(doc, revitLinkType.ElementId)
        revitLinkInstances.append(revitLinkInstance)
    TransactionManager.Instance.TransactionTaskDone()
except Exception as e:
    erro = f"An error occurred: {str(e)}"
    revitLinkInstances.append(erro)
    
OUT = revitLinkInstances