docs: def addAEMOD(rh):
      """
      Send an Activation Modification Script to the virtual machine.
  
      Input:
         Request Handle with the following properties:
            function    - 'CHANGEVM'
            subfunction - 'AEMOD'
            userid      - userid of the virtual machine
            parms['aeScript']   - File specification of the AE script
            parms['invparms']   - invparms operand
  
      Output:
         Request Handle updated with the results.
         Return code - 0: ok
         Return code - 4: input error, rs - 11 AE script not found
      """
      rh.printSysLog("Enter changeVM.addAEMOD")
      invokeScript = "invokeScript.sh"
      trunkFile = "aemod.doscript"
      fileClass = "X"
      tempDir = tempfile.mkdtemp()
  
      if os.path.isfile(rh.parms['aeScript']):
          # Get the short name of our activation engine modifier script
          if rh.parms['aeScript'].startswith("/"):
              s = rh.parms['aeScript']
              tmpAEScript = s[s.rindex("/") + 1:]
          else:
              tmpAEScript = rh.parms['aeScript']
  
          # Copy the mod script to our temp directory
          shutil.copyfile(rh.parms['aeScript'], tempDir + "/" + tmpAEScript)
  
          # Create the invocation script.
          conf = "#!/bin/bash \n"
          baseName = os.path.basename(rh.parms['aeScript'])
          parm = "/bin/bash %s %s \n" % (baseName, rh.parms['invParms'])
  
          fh = open(tempDir + "/" + invokeScript, "w")
          fh.write(conf)
          fh.write(parm)
          fh.close()
  
          # Generate the tar package for punch
          tar = tarfile.open(tempDir + "/" + trunkFile, "w")
          for file in os.listdir(tempDir):
              tar.add(tempDir + "/" + file, arcname=file)
          tar.close()
  
          # Punch file to reader
          punch2reader(rh, rh.userid, tempDir + "/" + trunkFile, fileClass)
          shutil.rmtree(tempDir)
  
      else:
          # Worker script does not exist.
          shutil.rmtree(tempDir)
          msg = msgs.msg['0400'][1] % (modId, rh.parms['aeScript'])
          rh.printLn("ES", msg)
          rh.updateResults(msgs.msg['0400'][0])
  
      rh.printSysLog("Exit changeVM.addAEMOD, rc: " +
          str(rh.results['overallRC']))
      return rh.results['overallRC']