'build signed parameters following
http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html'

def get_signed_url(self):

    keys = sorted(self.url_params)
    values = map(self.url_params.get, keys)
    url_string = urlencode(list(zip(keys, values)))
    string_to_sign = ('GET\n%s\n/\n%s' % (self.base_url, url_string))
    try:
        if (sys.version_info[:2] == (2, 5)):
            signature = hmac.new(key=self.secret_key, msg=string_to_sign, digestmod=hashlib.sha256).digest()
        else:
            signature = hmac.new(key=bytes(self.secret_key), msg=bytes(string_to_sign), digestmod=hashlib.sha256).digest()
    except TypeError:
        signature = hmac.new(key=self.secret_key.encode('utf-8'), msg=string_to_sign.encode('utf-8'), digestmod=hashlib.sha256).digest()
    signature = base64.encodestring(signature).strip()
    urlencoded_signature = quote_plus(signature)
    url_string += ('&Signature=%s' % urlencoded_signature)
    return ('/?' + url_string)
