Add checks to the toIso8601 function to handle None and empty strings
for the input (and return an empty string in both cases).