I'm working on an application using Flask-SQLAlchemy which needs to import and export data in `.csv` format. I have the export function working, but I've hit a snag with the import.

In short, I'm looking for a generic way to import the strings "True" and "False" as Boolean values, but *any other* string value as itself. The reason for this is that `csv.DictWriter` renders Boolean values as their string equivalents, and I need to import the resulting file back into the database.

I've tried `ast.literal_eval()`, but it throws a ValueError if I give it anything other than "True" or "False". I could test for the column name, but of course that would break as soon as I change my schema. I want to use the idiom

```
reader = csv.DictReader(fh)
...
for row in reader:
...
    contact = Contact.query.get(row['id'])
    for key, value in row.items():
        setattr(contact, key, value)

```

Can anyone suggest a way to achieve what I want to accomplish?