def _date_or_none(d: str) -> str:
try:<EOL><INDENT>datetime.strptime(d, '<STR_LIT>')<EOL>return d<EOL><DEDENT>except ValueError:<EOL><INDENT>return None<EOL><DEDENT>
Return a date as if, if valid, otherwise None

    >>> _date_or_none('2017-02-27')
    '2017-02-27'

    >>> _date_or_none('NA')