code: def _set_element_datetime(self, prop_name, value):
          
          if not isinstance(value, datetime):
              tmpl = (
                  "property requires <type 'datetime.datetime'> object, got %s"
              )
              raise ValueError(tmpl % type(value))
          element = self._get_or_add(prop_name)
          dt_str = value.strftime('%Y-%m-%dT%H:%M:%SZ')
          element.text = dt_str
          if prop_name in ('created', 'modified'):
              # These two require an explicit 'xsi:type="dcterms:W3CDTF"'
              # attribute. The first and last line are a hack required to add
              # the xsi namespace to the root element rather than each child
              # element in which it is referenced
              self.set(qn('xsi:foo'), 'bar')
              element.set(qn('xsi:type'), 'dcterms:W3CDTF')
              del self.attrib[qn('xsi:foo')]
docs: Set date/time value of child element having *prop_name* to *value*.