import itertools


def read_metadata(filename, skip, treename):
    """ Read the metadata csv file and return values ad a dictionary

    """
    temptreedict = {}
    with open(filename, 'r') as f:
        result = itertools.islice(f, skip, None)
        for line in result:
            ll = line.strip().split(",")
            if ll[0] == treename:
                temptreedict[ll[4]] = {'tree':ll[0], 'tax':ll[1], 'genome':ll[2],
                                       'protein':ll[3], 'fullname':ll[5],
                                       'genus':ll[6],
                                       'host_phylum':ll[7], 'host_order':ll[8],
                                       'host_class':ll[9],'host_common_name':ll[10], 'new':ll[11]}
    return temptreedict