code: def get_maybe_wb_for_batch(b: Batch):
      if "target_branch" in b.attributes and "pr" in b.attributes:
          branch = b.attributes["target_branch"]
          wbs = [
              wb
              for wb in watched_branches
              if wb.branch.short_str() == branch
          ]
          if len(wbs) == 0:
              pr = b.attributes["pr"]
              log.exception(
                  f"Attempted to load PR {pr} for unwatched branch {branch}"
              )
          else:
              assert len(wbs) == 1
              return wbs[0].index
      return None
  
imports: import asyncio
  import concurrent.futures
  import json
  import logging
  import os
  import traceback
  from contextlib import AsyncExitStack
  from typing import Any, Callable, Dict, List, NoReturn, Optional, Set, Tuple, TypedDict
  import aiohttp_session
  import kubernetes_asyncio
  import kubernetes_asyncio.client
  import kubernetes_asyncio.config
  import uvloop
  import yaml
  from aiohttp import web
  from gidgethub import aiohttp
  from gidgethub import routing
  from gidgethub import sansio
  from prometheus_async.aio.web import server_stats
  from gear import AuthServiceAuthenticator, Database, UserData, check_csrf_token, json_request, json_response, monitor_endpoints_middleware, setup_aiohttp_session
  from gear.profiling import install_profiler_if_requested
  from hailtop import aiotools, httpx
  from hailtop.auth import hail_credentials
  from hailtop.batch_client.aioclient import Batch, BatchClient
  from hailtop.config import get_deploy_config
  from hailtop.hail_logging import AccessLogger
  from hailtop.tls import internal_server_ssl_context
  from hailtop.utils import collect_aiter, humanize_timedelta_msecs, periodically_call, retry_transient_errors
  from web_common import render_template, set_message, setup_aiohttp_jinja2, setup_common_static_routes
  from .constants import AUTHORIZED_USERS, TEAMS
  from .environment import CLOUD, DEFAULT_NAMESPACE, STORAGE_URI
  from .envoy import create_cds_response, create_rds_response
  from .github import PR, WIP, FQBranch, MergeFailureBatch, Repo, UnwatchedBranch, WatchedBranch, select_random_teammate
  from .utils import gcp_logging_queries
label_desc: Use image node_id 4 for calling a global function with example usage: get_maybe_wb_for_batch(b) and returns: None, wbs