def create_date_from_text(self, text):
<EOL>date_matches = re.match(self.DATE_LINE_REGEXP, text)<EOL>if date_matches is None:<EOL><INDENT>date_matches = re.match(self.US_DATE_LINE_REGEXP, text)<EOL><DEDENT>if date_matches is None:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(date_matches.group(<NUM_LIT:1>)) == <NUM_LIT:4>:<EOL><INDENT>return datetime.date(int(date_matches.group(<NUM_LIT:1>)), int(date_matches.group(<NUM_LIT:2>)), int(date_matches.group(<NUM_LIT:3>)))<EOL><DEDENT>if len(date_matches.group(<NUM_LIT:3>)) == <NUM_LIT:2>:<EOL><INDENT>current_year = datetime.date.today().year<EOL>current_millennium = current_year - (current_year % <NUM_LIT:1000>)<EOL>year = current_millennium + int(date_matches.group(<NUM_LIT:3>))<EOL><DEDENT>else:<EOL><INDENT>year = int(date_matches.group(<NUM_LIT:3>))<EOL><DEDENT>return datetime.date(year, int(date_matches.group(<NUM_LIT:2>)), int(date_matches.group(<NUM_LIT:1>)))<EOL>
Parse a text in the form dd/mm/yyyy, dd/mm/yy or yyyy/mm/dd and return a corresponding :class:`datetime.date`
object. If no date can be extracted from the given text, a :exc:`ValueError` will be raised.