from typing import Union
from typing import Tuple
from typing import List


def get_subdomain(
    x: int, y: int, subdomains: Union[str, Tuple[str], List[str]] = "abc"
) -> str:
    """
    Returns a subdomain based on the position.
    Subdomains help supporting more simultaneous tile requests.
    https://github.com/Leaflet/Leaflet/blob/37d2fd15ad6518c254fae3e033177e96c48b5012/src/layer/tile/TileLayer.js#L222

    Args:
        x (int): X coord in the XYZ system.
        y (int): Y coord in the XYZ system.
        subdomains: List of letters made available by the tiles supplier.
                    Example:

                    * a string: "abcd" for subdomains a, b, c, and d
                    * or a tuple/list: ("10", "100", "101", "102", "103", "104", "20")

    Returns:
        str: One of the subdomain letter.
    """
    return subdomains[abs(x + y) % len(subdomains)]