code: def upload_marcxml(self, marcxml, mode):
          
          if mode not in ["-i", "-r", "-c", "-a", "-ir"]:
              raise NameError, "Incorrect mode " + str(mode)
  
          # Are we running locally? If so, submit directly
          if self.local:
              (code, marcxml_filepath) = tempfile.mkstemp(prefix="upload_%s" % \
                                                          time.strftime("%Y%m%d_%H%M%S_",
                                                                        time.localtime()))
              marcxml_file_d = os.fdopen(code, "w")
              marcxml_file_d.write(marcxml)
              marcxml_file_d.close()
              return task_low_level_submission("bibupload", "", mode, marcxml_filepath)
          else:
              params = urllib.urlencode({'file': marcxml,
                                          'mode': mode})
              ## We don't use self.browser as batchuploader is protected by IP
              opener = urllib2.build_opener()
              opener.addheaders = [('User-Agent', CFG_USER_AGENT)]
              return opener.open(self.server_url + "/batchuploader/robotupload", params,)
docs: Uploads a record to the server
  
          Parameters:
            marcxml - *str* the XML to upload.
               mode - *str* the mode to use for the upload.
                      "-i" insert new records
                      "-r" replace existing records
                      "-c" correct fields of records
                      "-a" append fields to records
                      "-ir" insert record or replace if it exists