import re


def expand_parameters(host, params):
    """Expand parameters in hostname.

    Examples:
    * "target{N}" => "target1"
    * "{host}.{domain} => "host01.example.com"

    """
    pattern = r"\{(.*?)\}"

    def repl(match):
        param_name = match.group(1)
        return params[param_name]

    return re.sub(pattern, repl, host)