def _str_to_time(self, str_value):
match = self.rx_time.match(str_value.upper())<EOL>if not match:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>gd = match.groupdict()<EOL>hour = int(gd['<STR_LIT>'])<EOL>minute = int(gd['<STR_LIT>'])<EOL>second = int(gd['<STR_LIT>'] or <NUM_LIT:0>)<EOL>if gd['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>hour += <NUM_LIT:12><EOL><DEDENT>return datetime.time(hour, minute, second)<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>return None<EOL><DEDENT>
Parses a `hh:mm` or a `hh:mm pm` string into a time object.