def build_put_params(self, params, name, value=None, timestamp=None, 
                        unit=None, dimensions=None, statistics=None):
        args = (name, value, unit, dimensions, statistics)
        length = max(map(lambda a: len(a) if isinstance(a, list) else 1, args))

        def aslist(a):
            if isinstance(a, list):
                if len(a) != length:
                    raise Exception('Must specify equal number of elements; expected %d.' % length)
                return a
            return [a] * length

        for index, (n, v, u, d, s) in enumerate(zip(*map(aslist, args))):
            metric_data = {'MetricName': n}

            if timestamp:
                metric_data['Timestamp'] = timestamp.isoformat()
            
            if unit:
                metric_data['Unit'] = u
            
            if dimensions:
                self.build_dimension_param(d, metric_data)
            
            if statistics:
                metric_data['StatisticValues.Maximum'] = s['maximum']
                metric_data['StatisticValues.Minimum'] = s['minimum']
                metric_data['StatisticValues.SampleCount'] = s['samplecount']
                metric_data['StatisticValues.Sum'] = s['sum']
                if value != None:
                    msg = 'You supplied a value and statistics for a metric.'
                    msg += 'Posting statistics and not value.'
                    boto.log.warn(msg)
            elif value != None:
                metric_data['Value'] = v
            else:
                raise Exception('Must specify a value or statistics to put.')

            for key, value in metric_data.iteritems():
                params['MetricData.member.%d.%s' % (index + 1, key)] = value
dataset/ETHPy150Open radlab/sparrow/deploy/third_party/boto-2.1.1/boto/ec2/cloudwatch/__init__.py/CloudWatchConnection.build_put_params/original