nl: if features.needs_datetime_string_cast field of the object represented stored under the db key of connections dictionary is true,
code: if connections [ db ] . features . needs_datetime_string_cast and not isinstance ( expires , datetime ) :