import re


def get_hostname(url: str):
    """Extract single hostname from the nested url

    Parameters
    ----------
    url : str

    Returns
    -------
    str
        The site contains protocol and hostname
    """
    return re.sub(r"(.*://)?([^/?]+).*", "\g<1>\g<2>", url)