code: def permission_allowed(actor, action):
      if action == "this_is_allowed":
          return True
      elif action == "this_is_denied":
          return False
      elif action == "view-database-download":
          return actor.get("can_download") if actor else None
      # Special permissions for latest.datasette.io demos
      # See https://github.com/simonw/todomvc-datasette/issues/2
      actor_id = None
      if actor:
          actor_id = actor.get("id")
      if actor_id == "todomvc" and action in (
          "insert-row",
          "create-table",
          "drop-table",
          "delete-row",
          "update-row",
      ):
          return True
  
imports: import asyncio
  from datasette import hookimpl, Permission
  from datasette.facets import Facet
  from datasette import tracer
  from datasette.utils import path_with_added_args
  from datasette.utils.asgi import asgi_send_json, Response
  import base64
  import pint
  import json
label_desc: Use image node_id 11 for calling a global function with example usage: permission_allowed(actor, action) and returns: True, True, False, unknown