python check if date string matches format