def tuple_to_address(addr):
    """
    Convert an (host, port) tuple into a host:port string.
    If one of the member is missing, the other is returned.
    """
    host, port = addr
    if host and port:
        return '{}:{}'.format(*addr)
    elif host and not port:
        return host
    elif port and not host:
        return port
    else:
        raise ValueError('invalid argument passed: %s' % str(addr))
