def clean_opf(container):
 manifest_id_map = container.manifest_id_map
 for meta in container.opf_xpath(u'//opf:meta[@name="cover" and @content]'):
  name = manifest_id_map.get(meta.get(u'content', None), None)
  container.remove_from_xml(meta)
  if (name and (name in container.name_path_map)):
   (yield name)
 gtm = container.guide_type_map
 for ref in container.opf_xpath(u'//opf:guide/opf:reference[@type]'):
  typ = ref.get(u'type', u'')
  if (typ.lower() in COVER_TYPES):
   container.remove_from_xml(ref)
   name = gtm.get(typ, None)
   if (name and (name in container.name_path_map)):
    (yield name)
 removed_names = container.apply_unique_properties(None, u'cover-image', u'calibre:title-page')[0]
 for name in removed_names:
  (yield name)
 container.dirty(container.opf_name)

def clean_opf ( container ) : manifest_id_map = container . manifest_id_map for meta in container . opf_xpath ( u'//opf:meta[@name="cover" and @content]' ) : name = manifest_id_map . get ( meta . get ( u'content' , None ) , None ) container . remove_from_xml ( meta ) if ( name and ( name in container . name_path_map ) ) : ( yield name ) gtm = container . guide_type_map for ref in container . opf_xpath ( u'//opf:guide/opf:reference[@type]' ) : typ = ref . get ( u'type' , u'' ) if ( typ . lower ( ) in COVER_TYPES ) : container . remove_from_xml ( ref ) name = gtm . get ( typ , None ) if ( name and ( name in container . name_path_map ) ) : ( yield name ) removed_names = container . apply_unique_properties ( None , u'cover-image' , u'calibre:title-page' ) [ 0 ] for name in removed_names : ( yield name ) container . dirty ( container . opf_name )
remove all references to covers from the opf .