def do_iso8601_to_str(s, format): try: return iso8601.parse_date(s).strftime(format) except iso8601.ParseError: return u''