def get_column_ids(column_names, *names, **optional):
    """Find all names in column_names and return their indices."""
    result = []
    for name in names:
        try:
            result.append(column_names.index(name))
        except ValueError:
            if 'optional' in optional and optional['optional']:
                result.append(None)
            else:
                raise ValueError('Column not found in input file: %s' % name)
    if len(result) == 1:
        return result[0]
    return tuple(result)
