code: def parse(cls, root):
          
          if root.tag != utils.lxmlns("mets") + "mdRef":
              raise exceptions.ParseError(
                  "MDRef can only parse mdRef elements with METS namespace."
              )
          # Required attributes
          mdtype = root.get("MDTYPE")
          if not mdtype:
              raise exceptions.ParseError("mdRef must have a MDTYPE")
          target = root.get(utils.lxmlns("xlink") + "href")
          if not target:
              raise exceptions.ParseError("mdRef must have an xlink:href.")
          try:
              target = utils.urldecode(target)
          except ValueError:
              raise exceptions.ParseError(
                  'Value "{}" (of attribute xlink:href) is not a valid'
                  " URL.".format(target)
              )
          loctype = root.get("LOCTYPE")
          if not loctype:
              raise exceptions.ParseError("mdRef must have a LOCTYPE")
          # Optional attributes
          label = root.get("LABEL")
          otherloctype = root.get("OTHERLOCTYPE")
  
          return cls(target, mdtype, loctype, label, otherloctype)
docs: Create a new MDWrap by parsing root.
  
          :param root: Element or ElementTree to be parsed into a MDWrap.