code: def app_port(worker_id: str) -> int:
      """Fixture that returns an available port on localhost."""
      if worker_id and worker_id != "master":
          # This is run with xdist, we try to get a port by hashing the worker ID
          port = hash_to_range(worker_id)
          if is_port_available(port, "localhost"):
              return port
      # Find a random available port:
      return find_available_port()
  
imports: from __future__ import annotations
  import hashlib
  import os
  import re
  import shlex
  import shutil
  import socket
  import subprocess
  import sys
  import time
  from io import BytesIO
  from pathlib import Path
  from random import randint
  from tempfile import TemporaryFile
  from types import ModuleType
  from typing import Any, Dict, Generator, List, Literal, Protocol, Tuple
  from urllib import parse
  import pytest
  import requests
  from PIL import Image
  from playwright.sync_api import ElementHandle, Locator, Page
  from pytest import FixtureRequest
label_desc: Use image node_id 11 for calling a global function with example usage: app_port(worker_id) and returns: find_available_port, port