def METHOD_NAME(self, vmx_path):
    """Stops a virtual machine.
    @param vmx_path: path to vmx file
    @raise CuckooMachineError: if unable to stop.
    """
    stop_string = (
        f"{self.options.vmwareserver.path} -T ws-shared -h {self.options.vmwareserver.vmware_url} -u {self.options.vmwareserver.username} "
        f'-p {self.options.vmwareserver.password} stop "{vmx_path}" hard'
    )
    log.debug("Stopping vm %s", vmx_path)
    # log.debug("Stop string: %s", stop_string)
    if self._is_running(vmx_path):
        try:
            if subprocess.call(stop_string, universal_newlines=True, shell=True):
                raise CuckooMachineError(f"Error shutting down machine {vmx_path}")
        except OSError as e:
            raise CuckooMachineError(f"Error shutting down machine {vmx_path}: {e}")
    else:
        log.warning("Trying to stop an already stopped machine: %s", vmx_path)