// Get credentials
credentials = service_account.Credentials.from_service_account_file(
filename=os.environ["GOOGLE_APPLICATION_CREDENTIALS"],
scopes=["https://www.googleapis.com/auth/cloud-platform"])
// Create the Cloud IAM service object
service = googleapiclient.discovery.build(
"iam", "v1", credentials=credentials)
// Call the Cloud IAM Roles API
// If using pylint, disable weak-typing warnings
// pylint: disable=no-member
response = service.roles().list().execute()
roles = response["roles"]
// Process the response
for role in roles: