def unparse_host_port(host, port=None):
    """
    Undo parse_host_port().
    """
    if ":" in host and not host.startswith("["):
        host = "[%s]" % host
    if port is not None:
        return "%s:%s" % (host, port)
    else:
        return host