import re
 
timestamp_regex = r'(2[0-3]|[01][0-9]|[0-9]):([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])'
 
 
print(bool(re.match(timestamp_regex, '01:23:45')))  # True
print(bool(re.match(timestamp_regex, '01:01:45')))  # True
print(bool(re.match(timestamp_regex, '01:01:01')))  # True
print(bool(re.match(timestamp_regex, '1:1:1')))     # True
print(bool(re.match(timestamp_regex, '25:1:1')))    # False