def load_clust(uclust_file, codes):
    clust_nums = [None for i in codes]
    all_clust_nums = []
    labels = []
    with open(uclust_file) as f:
        for line in f:
            fields = line.split()
            all_clust_nums.append(int(fields[1]))
            labels.append(fields[8])
    for (i, code) in enumerate(codes):
        try:
            idx = labels.index(code)
            clust_nums[i] = all_clust_nums[idx]
        except ValueError:
            continue
    return clust_nums
def load_clust(uclust_file, codes):
    clust_nums = [None for i in codes]
    all_clust_nums = []
    labels = []
    with open(uclust_file) as f:
        for line in f:
            fields = line.split()
            all_clust_nums.append(int(fields[1]))
            labels.append(fields[8])
    for (i, code) in enumerate(codes):
        try:
            idx = labels.index(code)
            clust_nums[i] = all_clust_nums[idx]
        except ValueError:
            continue
    return clust_nums