code: def write_token(ds, actor_id="root", permissions=None):
      to_sign = {"a": actor_id, "token": "dstok", "t": int(time.time())}
      if permissions:
          to_sign["_r"] = {"a": permissions}
      return "dstok_{}".format(ds.sign(to_sign, namespace="token"))
  
imports: from datasette.app import Datasette
  from datasette.utils import sqlite3
  import pytest
  import time
label_desc: Use image node_id 2 for calling a global function with example usage: write_token(ds, actor_id, permissions) and returns: str