def compute_signature(self, uri, params, utf=PY3):
s = uri<EOL>if len(params) > <NUM_LIT:0>:<EOL><INDENT>for k, v in sorted(params.items()):<EOL><INDENT>s += k + v<EOL><DEDENT><DEDENT>mac = hmac.new(self.token, s.encode("<STR_LIT:utf-8>"), sha1)<EOL>computed = base64.b64encode(mac.digest())<EOL>if utf:<EOL><INDENT>computed = computed.decode('<STR_LIT:utf-8>')<EOL><DEDENT>return computed.strip()<EOL>
Compute the signature for a given request

        :param uri: full URI that Twilio requested on your server
        :param params: post vars that Twilio sent with the request
        :param utf: whether return should be bytestring or unicode (python3)

        :returns: The computed signature