needquote = (" " in arg) or ("\t" in arg) or not arg
I believe arg
is of type datetime.datetime
and you are using in
operator on it. in
operator works only on objects which can be iterated, for example, lists, dicts, sets etc. So, what you need to do is, convert arg
to string using strftime