def METHOD_NAME(
    hostname: str,
    port: int = 1433,
    database: str = "MOSAIQ",
    alias: Optional[str] = None,
    username: Optional[str] = None,
    password: Optional[str] = None,
) -> Connection:
    """Connect to a Mosaiq SQL server.
    The first time running this function on a system will result in a
    prompt to login to the Mosaiq SQL server. The provided credentials
    will be stored within the operating system's password storage
    facilities. Subsequent calls to this function will pull from that
    password storage in order to connect.
    Can optionally be called as a context manager. This will close the
    database connection once leaving the context manager.
    Parameters
    ----------
    hostname : str
        The IP address or hostname of the SQL server.
    port : int, optional
        The port at which the SQL server is hosted, by default ``1433``
    database : str, optional
        The MSSQL database name, by default ``"MOSAIQ"``
    alias : Optional[str], optional
        A human readable representation of the server, this is the name
        of the server presented to the user should there not be
        credentials already on the machine, by default ``"hostname:port/database"``
    username : Optional[str], optional
        Provide a username to login to the database with, by default the
        username is either pulled from the system's credential storage,
        or an interactive prompt is used.
    password : Optional[str], optional
        Provide a password to login to the database with, by default the
        password is either pulled from the system's credential storage,
        or an interactive prompt is used.
    Returns
    -------
    connection : pymedphys.mosaiq.Connection
        A database connection. This connection can be passed to
        :func:`pymedphys.mosaiq.execute` to be able to run queries.
        The method ``close()`` can be called on this object to close the
        database connection.
    Examples
    --------
    See :func:`pymedphys.mosaiq.execute` for examples of usage.
    """
    if username is None and password is None:
        username, password = _credentials.get_username_password_with_prompt_fallback(
            hostname=hostname, port=port, database=database, alias=alias
        )
    if username is None or password is None:
        raise ValueError(
            "Must either provide both username and password, or neither of them."
        )
    connection = _connect.connect_with_credentials(
        username, password, hostname=hostname, port=port, database=database
    )
    return connection