parameters: (self, vmx_path, snapshot)
docstring: Check snapshot existence.
          @param vmx_path: path to vmx file
          @param snapshot: snapshot name
          @raise CuckooMachineError: if snapshot not found
docstring_summary: Check snapshot existence.
docstring_tokens: Check snapshot existence .
function: def _check_snapshot(self, vmx_path, snapshot):
          """Check snapshot existence.
          @param vmx_path: path to vmx file
          @param snapshot: snapshot name
          @raise CuckooMachineError: if snapshot not found
          """
          try:
              p = subprocess.Popen([self.options.vmware.path,
                                    "listSnapshots", vmx_path],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
              output, _ = p.communicate()
              output = output.decode("utf-8")
          except OSError as e:
              raise CuckooMachineError("Unable to get snapshot list for %s. "
                                       "Reason: %s" % (vmx_path, e))
          else:
              if output:
                  return snapshot in output
              else:
                  raise CuckooMachineError("Unable to get snapshot list for %s. "
                                           "No output from "
                                           "`vmrun listSnapshots`" % vmx_path)
function_tokens: def _check_snapshot ( self , vmx_path , snapshot ) : try : p = subprocess . Popen ( [ self . options . vmware . path , "listSnapshots" , vmx_path ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) output , _ = p . communicate ( ) output = output . decode ( "utf-8" ) except OSError as e : raise CuckooMachineError ( "Unable to get snapshot list for %s. " "Reason: %s" % ( vmx_path , e ) ) else : if output : return snapshot in output else : raise CuckooMachineError ( "Unable to get snapshot list for %s. " "No output from " "`vmrun listSnapshots`" % vmx_path )