def choose_representative_strain(cluster, tree):
    """
    Given a cluster, will find which tip in that cluster tends to be closest to all others (aka the best representative)
    and return that tip
    :param cluster: Cluster found.
    :param tree: Tree read in by Bio.Phylo
    :return: representative strain.
    """
    representative = 'NA'
    best_distance = 100000000.0  # Start off at an absolutely ridiculous value.
    # Iterate through
    for strain1 in cluster:
        total_length = 0.0
        for strain2 in cluster:
            if strain1 != strain2:
                total_length += tree.distance(strain1, strain2)
        if total_length < best_distance:
            best_distance = total_length
            representative = strain1
    return representative