def setup(hosts, graph_name, username=None, password=None, index_all_fields=False, statsd=None):
    """
    Records the hosts and connects to one of them.

    :param hosts: list of hosts, strings in the <hostname>:<port> or just <hostname> format
    :type hosts: list of str
    :param graph_name: The name of the graph as defined in the rexster.xml
    :type graph_name: str
    :param username: The username for the rexster server
    :type username: str
    :param password: The password for the rexster server
    :type password: str
    :param index_all_fields: Toggle automatic indexing of all vertex fields
    :type index_all_fields: boolean
    :param statsd: host:port or just host of statsd server to report metrics to
    :type statsd: str
    :rtype None
    """
    global _hosts
    global _graph_name
    global _username
    global _password
    global _index_all_fields
    global _statsd

    _graph_name = graph_name
    _username = username
    _password = password
    _index_all_fields = index_all_fields


    if statsd:
        try:
            sd = statsd
            import statsd
            tmp = sd.split(':')
            if len(tmp) == 1:
                tmp.append('8125')
            _statsd = statsd.StatsClient(tmp[0], int(tmp[1]), prefix='thunderdome')
        except __HOLE__:
            logging.warning("Statsd configured but not installed.  Please install the statsd package.")
        except:
            raise

    for host in hosts:
        host = host.strip()
        host = host.split(':')
        if len(host) == 1:
            _hosts.append(Host(host[0], 8182))
        elif len(host) == 2:
            _hosts.append(Host(*host))
        else:
            raise ThunderdomeConnectionError("Can't parse {}".format(''.join(host)))

    if not _hosts:
        raise ThunderdomeConnectionError("At least one host required")

    random.shuffle(_hosts)
    
    create_unique_index('vid', 'String')

    #index any models that have already been defined
    from thunderdome.models import vertex_types
    for klass in vertex_types.values():
        klass._create_indices()
dataset/ETHPy150Open StartTheShift/thunderdome/thunderdome/connection.py/setup