def zk_conn_from_hosts(hosts, chroot=None):
    """
    Make a Zookeeper connection string from a list of (host,port) tuples.
    """
    if chroot and not chroot.startswith('/'):
        chroot = '/' + chroot
    return ','.join(['%s:%s' % (host,port) for host, port in hosts]) + chroot or ''