def METHOD_NAME(next_timestamp):
    async def _realm_generate_certif_and_update_roles_or_fail(
        ws, author, realm_id, user_id, role, timestamp=None
    ):
        certif = RealmRoleCertificate(
            author=author.device_id,
            timestamp=timestamp or next_timestamp(),
            realm_id=realm_id,
            user_id=user_id,
            role=role,
        ).dump_and_sign(author.signing_key)
        return await realm_update_roles(ws, certif, check_rep=False)
    return _realm_generate_certif_and_update_roles_or_fail