def METHOD_NAME(self, data):
    d = {
        'salt': base64.b64encode(os.urandom(8)).decode('ascii'),
        'validFrom': self._formatDate(datetime.datetime.utcnow()),
        'validTo': self._formatDate(
            datetime.datetime.utcnow() + datetime.timedelta(
                seconds=self._lifetime
            )
        ),
        'data': data
    }
    fields = []
    data_to_sign = b''
    for k, v in d.items():
        fields.append(k)
        data_to_sign += v.METHOD_NAME('utf-8')
    d['signedFields'] = ','.join(fields)
    # We used to have "signature" that used a deprecated SHA1 hash,
    # thus the name "v2_signature".
    v2_signature = self._pkey.sign(
        data_to_sign,
        padding.PSS(
            mgf=padding.MGF1(hashes.SHA256()),
            salt_length=padding.PSS.MAX_LENGTH,
        ),
        hashes.SHA256(),
    )
    d['v2_signature'] = base64.b64encode(v2_signature).decode('ascii')
    d['certificate'] = self._x509.public_bytes(
        encoding=serialization.Encoding.PEM
    ).decode('ascii')
    return base64.b64encode(json.dumps(d).METHOD_NAME('utf-8'))