def meter_message_from_counter(sample, secret):
 msg = {'source': sample.source, 'counter_name': sample.name, 'counter_type': sample.type, 'counter_unit': sample.unit, 'counter_volume': sample.volume, 'user_id': sample.user_id, 'project_id': sample.project_id, 'resource_id': sample.resource_id, 'timestamp': sample.timestamp, 'resource_metadata': sample.resource_metadata, 'message_id': sample.id}
 msg['message_signature'] = compute_signature(msg, secret)
 return msg

def meter_message_from_counter ( sample , secret ) : msg = { 'source' : sample . source , 'counter_name' : sample . name , 'counter_type' : sample . type , 'counter_unit' : sample . unit , 'counter_volume' : sample . volume , 'user_id' : sample . user_id , 'project_id' : sample . project_id , 'resource_id' : sample . resource_id , 'timestamp' : sample . timestamp , 'resource_metadata' : sample . resource_metadata , 'message_id' : sample . id } msg [ 'message_signature' ] = compute_signature ( msg , secret ) return msg
make a metering message ready to be published or stored .