def _cast(self, value, format=None, **opts):
        """Optionally apply a format string."""
        if format is not None:
            return datetime.strptime(value, format)
        return dateutil.parser.parse(value)
Optionally apply a format string.