I am building a Pipeline template in Jupyter Notebook using this documentation from Snowflake and have reached the section where the doc states to ADD PEOPLE TO THIS PROJECT.

I've manually built the Pipeline and worked but I need to have it in a template that would be easy to deploy on other instances. I created the notification integration in snowflake and got my service account using desc notification integration my_int. I need to assign this service account the Monitoring Viewer role but can't find the library that allows me to do that.
EDIT (Thanks @erhard):
I realised I was using a different serviceName in my discovery.build.
Here is the working code:
from googleapiclient import discovery
gccreds = json.loads(open('gccreds.json', 'rt').read())
credentials = service_account.Credentials.from_service_account_info(gccreds)
crm_service = discovery.build(
serviceName='cloudresourcemanager',
version='v1',
credentials=credentials)
gcp_pubsub_service_account = '<VALUE FROM SNOWFLAKE>'
policy = (
crm_service.projects()
.getIamPolicy(
resource=project_id
)
.execute()
)
_ = [x for x in policy["bindings"] if f"serviceAccount:{gcp_pubsub_service_account}" in x["members"]] == []
if _:
binding = {"role": "roles/monitoring.viewer", "members": [f"serviceAccount:{gcp_pubsub_service_account}"]}
policy["bindings"].append(binding)
print(f"Added '{gcp_pubsub_service_account}' with role 'roles/monitoring.viewer' to project")
else:
print(f"'{gcp_pubsub_service_account}' with role 'roles/monitoring.viewer' to project already exists.")