import csv


def load_cluster(path, iso3):
    """
    Load cluster number. You need to make sure the
    R clustering script (pytal/vis/clustering/clustering.r)
    has been run first.

    Parameters
    ----------
    path : string
        Directory path to the capacity lookup table, generated by pysim5g.
    iso3 : string
        The ISO 3-digital country code for the country being modeled.

    """
    with open(path, 'r') as source:
        reader = csv.DictReader(source)
        for row in reader:
            if row['ISO_3digit'] == iso3:
                return row['cluster']