code: def str_to_timedelta(input_str):
      
      try:
          input_str = input_str.replace(' ', ':')
      except (TypeError, AttributeError):
          from configman.converters import to_str
          raise TypeError('%s should have been a string' % to_str(input_str))
      days, hours, minutes, seconds = 0, 0, 0, 0
      details = input_str.split(':')
      if len(details) >= 4:
          days = int(details[-4])
      if len(details) >= 3:
          hours = int(details[-3])
      if len(details) >= 2:
          minutes = int(details[-2])
      if len(details) >= 1:
          seconds = int(details[-1])
      return datetime.timedelta(days=days,
                                hours=hours,
                                minutes=minutes,
                                seconds=seconds)
docs: a string conversion function for timedelta for strings in the format
      DD:HH:MM:SS or D HH:MM:SS