code: def through_filters(request, database, table, datasette):
      # ?_search= and _search_colname=
      async def inner():
          where_clauses = []
          params = {}
          human_descriptions = []
          extra_context = {}
  
          # Support for ?_through={table, column, value}
          if "_through" in request.args:
              for through in request.args.getlist("_through"):
                  through_data = json.loads(through)
                  through_table = through_data["table"]
                  other_column = through_data["column"]
                  value = through_data["value"]
                  db = datasette.get_database(database)
                  outgoing_foreign_keys = (
                      await db.foreign_keys_for_table(through_table)
                  )
                  try:
                      fk_to_us = [
                          fk
                          for fk in outgoing_foreign_keys
                          if fk["other_table"] == table
                      ][0]
                  except IndexError:
                      raise DatasetteError(
                          "Invalid _through - could not find corresponding foreign key"
                      )
                  param = f"p{len(params)}"
                  where_clauses.append(
                      "{our_pk} in (select {our_column} from {through_table} where {other_column} = :{param})".format(
                          through_table=escape_sqlite(through_table),
                          our_pk=escape_sqlite(
                              fk_to_us["other_column"]
                          ),
                          our_column=escape_sqlite(fk_to_us["column"]),
                          other_column=escape_sqlite(other_column),
                          param=param,
                      )
                  )
                  params[param] = value
                  human_descriptions.append(
                      f'{through_table}.{other_column} = "{value}"'
                  )
  
          return FilterArguments(
              where_clauses, params, human_descriptions, extra_context
          )
  
      return inner
  
imports: from datasette import hookimpl
  from datasette.views.base import DatasetteError
  from datasette.utils.asgi import BadRequest
  import json
  import numbers
  from .utils import detect_json1, escape_sqlite, path_with_removed_args
label_desc: Use image node_id 3 for calling a global function with example usage: through_filters(request, database, table, datasette) and returns: inner, FilterArguments