from datetime import datetime


def safe_strptime(s):
    """
    safely parse string into datatime, can cope with time strings in format hh:mm:ss
    if hh > 23 then adds a day
    """
    if int(s.split(':')[0]) > 23:
        days, hours = divmod(int(s.split(':')[0]),24)
        string = f"{days+1}-{hours:02d}" + s[-6:]
        return datetime.strptime(string, '%d-%H:%M:%S')
    return datetime.strptime(s, '%H:%M:%S')