def _format_is_iso(f):
 iso_template = '%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S.%f'.format
 excluded_formats = ['%Y%m%d', '%Y%m', '%Y']
 for date_sep in [' ', '/', '\\', '-', '.', '']:
  for time_sep in [' ', 'T']:
   if (iso_template(date_sep=date_sep, time_sep=time_sep).startswith(f) and (f not in excluded_formats)):
    return True
 return False

def _format_is_iso ( f ) : iso_template = '%Y{date_sep}%m{date_sep}%d{time_sep}%H:%M:%S.%f' . format excluded_formats = [ '%Y%m%d' , '%Y%m' , '%Y' ] for date_sep in [ ' ' , '/' , '\\' , '-' , '.' , '' ] : for time_sep in [ ' ' , 'T' ] : if ( iso_template ( date_sep = date_sep , time_sep = time_sep ) . startswith ( f ) and ( f not in excluded_formats ) ) : return True return False
does format match the iso8601 set that can be handled by the c parser? generally of form yyyy-mm-ddthh:mm:ss - date separator can be different but must be consistent .