def read_filterwheel(fname):
    """Read a single definition from a filterwheel file."""
    result = {}
    with open(fname, 'r') as f:
        for line in f:
            words = line.split()
            if len(words) not in (2, 3):
                raise Exception('illegal line in filterwheel file')
            result[words[0]] = words[-1]
    return result
