def METHOD_NAME(self, value, param, ctx):
    if value is None:
        return value
    if isinstance(value, datetime):
        return value
    try:
        return ciso8601.parse_datetime(value)
    except ValueError:
        self.fail(
            (
                "Invalid date string {!r}. Expected any ISO date/time format "
                '(eg. "2017-04-03" or "2014-05-14 12:34")'.format(value)
            ),
            param,
            ctx,
        )