1from dateutil.parser import parse
2
3def is_date(string, fuzzy=False):
4 """
5 Return whether the string can be interpreted as a date.
6
7 :param string: str, string to check for date
8 :param fuzzy: bool, ignore unknown tokens in string if True
9 """
10 try:
11 parse(string, fuzzy=fuzzy)
12 return True
13
14 except ValueError:
15 return False