code: def parse_timedelta(value):
      
      if value is None:
          return None
  
      if not isinstance(value, six.string_types):
          raise TypeError('value must be a string type')
  
      match = INTERVAL_REGEX.search(value)
  
      if match:
          data = match.groupdict()
          return timedelta(**dict((key, int(data[key] or 0)) for key in data))
      else:
          raise ValueError("Value '%s' doesn't appear to be a valid timedelta "
                           "string" % value)
docs: Parses a string and return a datetime.timedelta.
      :param value: string to parse
      :type value: str
      :return: timedelta object or None if value is None
      :rtype: timedelta/None
      :raise: TypeError when value is not string
      :raise: ValueError when value is not proper timedelta string