#NEWLINE# def setup_api( service_account = True ) : #NEWLINE# #INDENT# 'Sets up a usable Compute API object.\n\n  Args:\n    service_account: If true, authorize using service accounts. This only works\n      on the coordinator instance. Otherwise, authorize using a local config\n      file or using the webserver oauth flow.\n  ' #NEWLINE# global api #NEWLINE# if service_account : #NEWLINE# #INDENT# creds = gcelib . gce_util . ServiceAccountCredentials ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# creds = gcelib . gce_util . get_credentials ( ) #NEWLINE# #UNINDENT# api = gcelib . gce_v1beta13 . GoogleComputeEngine ( api , default_project = cfg . project_id , logging_level = logging . ERROR )