code: def iterative_closest_divisors(
      hw: int, aspect_ratio: float
  ) -> tuple[int, int]:
      """
      Finds h and w such that h*w = hw and h/w = aspect_ratio
      We check all possible divisors of hw and return the closest to the aspect ratio
      """
      divisors = [
          i for i in range(2, hw + 1) if hw % i == 0
      ]  # all divisors of hw
      pairs = [
          (i, hw // i) for i in divisors
      ]  # all pairs of divisors of hw
      ratios = [
          w / h for h, w in pairs
      ]  # all ratios of pairs of divisors of hw
      closest_ratio = min(
          ratios, key=lambda x: abs(x - aspect_ratio)
      )  # closest ratio to aspect_ratio
      closest_pair = pairs[
          ratios.index(closest_ratio)
      ]  # closest pair of divisors to aspect_ratio
      return closest_pair
  
file_path: stable-diffusion-webui/extensions-builtin/hypertile/hypertile.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Callable
  from functools import wraps, cache
  import math
  import torch.nn
  import random
  from einops import rearrange
label_desc: Use image node_id 5 for calling a global function with example usage: iterative_closest_divisors(hw, aspect_ratio) and returns: closest_pair