def get_custom_metric(client, project_id, custom_metric_type):
 request = client.projects().metricDescriptors().list(name=project_id, filter='metric.type=starts_with("{}")'.format(custom_metric_type))
 response = request.execute()
 print 'ListCustomMetrics response:'
 pprint.pprint(response)
 try:
  return response['metricDescriptors']
 except KeyError:
  return None

def get_custom_metric ( client , project_id , custom_metric_type ) : request = client . projects ( ) . metricDescriptors ( ) . list ( name = project_id , filter = 'metric.type=starts_with("{}")' . format ( custom_metric_type ) ) response = request . execute ( ) print 'ListCustomMetrics response:' pprint . pprint ( response ) try : return response [ 'metricDescriptors' ] except KeyError : return None
retrieve the custom metric we created .