import hmac
import hashlib


def generate_gte_signature(apikey, secret, expires, data_str):  
    """Generate a request signature compatible with GTE."""
    # print "Computing HMAC: %s" % verb + path + str(nonce) + data
    message = apikey +  str(expires) + data_str
    print('message str:'+ message)

    signature = hmac.new(bytes(secret, 'utf8'), bytes(message, 'utf8'), digestmod=hashlib.sha256).hexdigest()
    print('signature str:'+signature)

    return signature