docs: def _is_valid_date(obj, accept_none=True):
      """
      Check if an object is an instance of, or a subclass deriving from, a
      ``date``. However, it does not consider ``datetime`` or subclasses thereof
      as valid dates.
  
      :param obj: Object to test as date.
      :param accept_none: If True None is considered as a valid date object.
      """
  
      if accept_none and obj is None:
          return True
      return isinstance(obj, date) and not isinstance(obj, datetime)