def gce_credentials_from_config(gce_credentials_config=None):
 if (gce_credentials_config is not None):
  credentials = ServiceAccountCredentials.from_p12_keyfile_buffer(service_account_email=gce_credentials_config['client_email'], file_buffer=BytesIO(gce_credentials_config['private_key']), scopes=[u'https://www.googleapis.com/auth/compute'])
 else:
  credentials = GoogleCredentials.get_application_default()
 return credentials

def gce_credentials_from_config ( gce_credentials_config = None ) : if ( gce_credentials_config is not None ) : credentials = ServiceAccountCredentials . from_p12_keyfile_buffer ( service_account_email = gce_credentials_config [ 'client_email' ] , file_buffer = BytesIO ( gce_credentials_config [ 'private_key' ] ) , scopes = [ u'https://www.googleapis.com/auth/compute' ] ) else : credentials = GoogleCredentials . get_application_default ( ) return credentials
this function creates a proper gce credentials object either from a passed in configuration blob or .