What is 'libyaml'?  Presumably the 'yaml' library? And use

return isinstance(this_date, date)