code: def deserialize_duration(attr):
          
          if isinstance(attr, ET.Element):
              attr = attr.text
          try:
              duration = isodate.parse_duration(attr)
          except(ValueError, OverflowError, AttributeError) as err:
              msg = "Cannot deserialize duration object."
              raise_with_traceback(DeserializationError, msg, err)
          else:
              return duration
docs: Deserialize ISO-8601 formatted string into TimeDelta object.
  
          :param str attr: response string to be deserialized.
          :rtype: TimeDelta
          :raises: DeserializationError if string format invalid.