def replace_links(container, link_map, frag_map=(lambda name, frag: frag), replace_in_opf=False):
 for (name, media_type) in container.mime_map.iteritems():
  if ((name == container.opf_name) and (not replace_in_opf)):
   continue
  repl = LinkReplacer(name, container, link_map, frag_map)
  container.replace_links(name, repl)

def replace_links ( container , link_map , frag_map = ( lambda name , frag : frag ) , replace_in_opf = False ) : for ( name , media_type ) in container . mime_map . iteritems ( ) : if ( ( name == container . opf_name ) and ( not replace_in_opf ) ) : continue repl = LinkReplacer ( name , container , link_map , frag_map ) container . replace_links ( name , repl )
replace links to files in the container .