from typing import Dict


def unparse_connection(dsn: Dict[str, str]) -> str:
    """Return connection string for pretty printing or copying when starting psql."""
    values = dict(dsn)
    for key in ("user", "port"):
        if key not in values:
            values[key] = "<default>"
    return "host={host} port={port} dbname={database} user={user} password=***".format_map(values)