code: def fix_location_tag(dom):
      
      location = dom.match(
          "mods:mods",
          "mods:location",
      )
  
      # if no location tag found, there is nothing to be fixed
      if not location:
          return
      location = first(location)
  
      # fix only <mods:location> containing <mods:physicalLocation> tags
      if not location.find("mods:physicalLocation"):
          return
  
      url = location.find("mods:url", {"usage": "primary display"})
  
      # parse URL
      if url:
          url = first(url).getContent()
      else:
          urls = filter(
              lambda x: x.getContent(),
              location.find("mods:url")
          )
  
          if not urls:
              return
  
          url_tag = max(urls, key=lambda x: len(x.getContent()))
          url = url_tag.getContent()
  
      # replace the code with new tag
      replacer = dhtmlparser.parseString("""
    <mods:location>
      <mods:holdingSimple>
        <mods:copyInformation>
          <mods:electronicLocator>""" + url + """</mods:electronicLocator>
        </mods:copyInformation>
      </mods:holdingSimple>
    </mods:location>
      """)
  
      location.replaceWith(
          first(replacer.find("mods:location"))
      )
  
      dhtmlparser.makeDoubleLinked(dom)
docs: Repair the <mods:location> tag (the XSLT template returns things related to
      paper books, not electronic documents).