from datetime import timedelta

def parseTimeDelta(s):
    d = re.match(
        '((?P<days>\\d+) days, )?(?P<hours>\\d+):(?P<minutes>\\d+):(?P<seconds>\\d+)\\.(?P<milliseconds>\\d+)'
        , str(s)).groupdict(0)
return timedelta(**dict((key, int(value)) for key, value in list(d.items())))
How to deal with time values over 24 hours in python?