def read_usernames(filename):
    try:
        rows = [r for r in csv.reader(open(filename))]
        try:
            idx = rows[0].index('username')
            unames = [row[idx].lower() for row in rows[1:]]
        except ValueError:
            unames = [r[0] for r in rows]
        return sorted(set(unames))
    except IOError, e:
        # File doesn't exist
        return []
Extracts usernames from the given file, returning a sorted list.
dataset/ETHPy150Open everett-wetchler/okcupid/FetchProfiles.py/read_usernames