class_docstr: Data representing the interval between two dates and/or times.
class_docstr_tok: ["Data","representing","the","interval","between","two","dates","and\/or","times","."]
docstr: Cast a single value to :class:`datetime.timedelta`.
  
  :param d:
      A value to cast.
  :returns:
      :class:`datetime.timedelta` or :code:`None`
docstr_tok: ["Cast","a","single","value","to",":","class",":","`","datetime.timedelta","`",".",":","param","d",":","A","value","to","cast",".",":","returns",":",":","class",":","`","datetime.timedelta","`","or",":","code",":","`","None","`"]
code: def cast(self, d):
      """
      Cast a single value to :class:`datetime.timedelta`.
  
      :param d:
          A value to cast.
      :returns:
          :class:`datetime.timedelta` or :code:`None`
      """
      if isinstance(d, datetime.timedelta) or d is None:
          return d
      if isinstance(d, str):
          d = d.strip()
  
          if d.lower() in self.null_values:
              return None
      else:
          raise CastError('Can not parse value "%s" as timedelta.' % d)
  
      try:
          seconds = pytimeparse.parse(d)
      except AttributeError:
          seconds = None
  
      if seconds is None:
          raise CastError(
              'Can not parse value "%s" to as timedelta.' % d
          )
  
      return datetime.timedelta(seconds=seconds)
  
imports: import datetime
  import pytimeparse
  from agate.data_types.base import DataType
  from agate.exceptions import CastError
label_desc: Use image node_id 1 for calling the TimeDelta obj's underlying member method code with example usage: obj.cast(d) and returns: datetime, d, None