def METHOD_NAME(request, response):
  if _should_treat_as_public_once(request):
    return (400, [], "received preflight for first treat-as-public request")
  uuid = _get_preflight_uuid(request)
  if uuid is None:
    return (400, [], "missing `preflight-uuid` param from preflight URL")
  value = request.server.stash.take(uuid)
  request.server.stash.put(uuid, "preflight")
  if _get_expect_single_preflight(request) and value is not None:
    return (400, [], "received duplicated preflight")
  method = request.headers.get("Access-Control-Request-Method")
  mode = request.GET.get(b"preflight-headers")
  headers = _get_response_headers(method, mode)
  return (headers, "preflight")