In case that MODS contains no URL and the location is wrong (physical), add
    url from `url` parameter.

def fix_missing_electronic_locator_tag(dom, url):
    """
    In case that MODS contains no URL and the location is wrong (physical), add
    url from `url` parameter.
    """
    electronic_locator = dom.match(
        "mods:mods",
        "mods:location",
        "mods:holdingSimple",
        "mods:copyInformation",
        "mods:electronicLocator",
    )
    # do not try to fix correct records
    if electronic_locator:
        return

    # if no location tag found, add it
    location = dom.match("mods:mods", "mods:location")
    if location:
        location = first(location)
    else:
        location_tag = dhtmlparser.parseString(
            "<mods:location></mods:location>"
        )

        insert_tag(
            location_tag,
            dom.find("mods:recordInfo"),
            get_mods_tag(dom)
        )

        location = first(dom.match("mods:mods", "mods:location"))

    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"))
    )