code: def downloadMARCXML(doc_id, library, base="nkc"):
      
      downer = Downloader()
  
      data = downer.download(
          ALEPH_URL + Template(DOC_URL_TEMPLATE).substitute(
              DOC_ID=doc_id,
              LIBRARY=library
          )
      )
  
      dom = dhtmlparser.parseString(data)
  
      # check if there are any errors
      # bad library error
      error = dom.find("login")
      if error:
          error_msg = error[0].find("error")
  
          if error_msg:
              raise LibraryNotFoundException(
                  "Can't download document doc_id: '" + str(doc_id) + "' " +
                  "(probably bad library: '" + library + "')!\nMessage: " +
                  "\n".join(map(lambda x: x.getContent(), error_msg))
              )
  
      # another error - document not found
      error = dom.find("ill-get-doc")
      if error:
          error_msg = error[0].find("error")
  
          if error_msg:
              raise DocumentNotFoundException(
                  "\n".join(map(lambda x: x.getContent(), error_msg))
              )
  
      return data
docs: Download MARC XML document with given `doc_id` from given `library`.
  
      Args:
          doc_id (DocumentID): You will get this from :func:`getDocumentIDs`.
          library (str): "``NKC01``" in our case, but don't worry,
                     :func:`getDocumentIDs` adds library specification into
                     :class:`DocumentID` named tuple.
  
      Returns:
          str: MARC XML unicode string.
  
      Raises:
          LibraryNotFoundException
          DocumentNotFoundException