code: def from_json(cls, doc):
          
          if not isinstance(doc, basestring):
              raise TypeError("JSON document must be a string")
          match = cls.PATTERN.match(doc)
          if not match:
              raise ValueError("JSON document must match expected pattern")
          days, seconds, microseconds = map(int, match.groups())
          return timedelta(days, seconds, microseconds)
docs: Deserialize JSON document (string) to datetime.timedelta instance