def create_time_from_text(text):
text = text.replace('<STR_LIT::>', '<STR_LIT>')<EOL>if not re.match('<STR_LIT>', text):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>minutes = int(text[-<NUM_LIT:2>:])<EOL>hours = int(text[<NUM_LIT:0>:<NUM_LIT:2>] if len(text) > <NUM_LIT:3> else text[<NUM_LIT:0>])<EOL>return datetime.time(hours, minutes)<EOL>
Parse a time in the form ``hh:mm`` or ``hhmm`` (or even ``hmm``) and return a :class:`datetime.time` object. If no
valid time can be extracted from the given string, :exc:`ValueError` will be raised.