def write_properties(props):
 root = Element(('{%s}coreProperties' % COREPROPS_NS))
 for attr in ('creator', 'title', 'description', 'subject', 'identifier', 'language'):
  SubElement(root, ('{%s}%s' % (DCORE_NS, attr))).text = getattr(props, attr)
 for attr in ('created', 'modified'):
  value = datetime_to_W3CDTF(getattr(props, attr))
  SubElement(root, ('{%s}%s' % (DCTERMS_NS, attr)), {('{%s}type' % XSI_NS): ('%s:W3CDTF' % DCTERMS_PREFIX)}).text = value
 for attr in ('lastModifiedBy', 'category', 'contentStatus', 'version', 'revision', 'keywords'):
  SubElement(root, ('{%s}%s' % (COREPROPS_NS, attr))).text = getattr(props, attr)
 if (props.lastPrinted is not None):
  SubElement(root, ('{%s}lastPrinted' % COREPROPS_NS)).text = datetime_to_W3CDTF(props.lastPrinted)
 return tostring(root)

def write_properties ( props ) : root = Element ( ( '{%s}coreProperties' % COREPROPS_NS ) ) for attr in ( 'creator' , 'title' , 'description' , 'subject' , 'identifier' , 'language' ) : SubElement ( root , ( '{%s}%s' % ( DCORE_NS , attr ) ) ) . text = getattr ( props , attr ) for attr in ( 'created' , 'modified' ) : value = datetime_to_W3CDTF ( getattr ( props , attr ) ) SubElement ( root , ( '{%s}%s' % ( DCTERMS_NS , attr ) ) , { ( '{%s}type' % XSI_NS ) : ( '%s:W3CDTF' % DCTERMS_PREFIX ) } ) . text = value for attr in ( 'lastModifiedBy' , 'category' , 'contentStatus' , 'version' , 'revision' , 'keywords' ) : SubElement ( root , ( '{%s}%s' % ( COREPROPS_NS , attr ) ) ) . text = getattr ( props , attr ) if ( props . lastPrinted is not None ) : SubElement ( root , ( '{%s}lastPrinted' % COREPROPS_NS ) ) . text = datetime_to_W3CDTF ( props . lastPrinted ) return tostring ( root )
write the core properties to xml .