def unquote(cls, string):
        """ Removes quotes from a quoted string.

        Splunk search command quote rules are applied. The enclosing
        double-quotes, if present, are removed. Escaped double-quotes ('\"' or
        '""') are replaced by a single double-quote ('"').

        **NOTE**

        We are not using a json.JSONDecoder because Splunk quote rules are
        different than JSON quote rules. A json.JSONDecoder does not recognize
        a pair of double-quotes ('""') as an escaped quote ('"') and will decode
        single-quoted strings ("'") in addition to double-quoted ('"') strings.

        """
        if len(string) == 0:
            return ''

        if string[0] != '"':
            return string

        if len(string) == 1:
            return string

        if string[-1] != '"':
            raise ValueError("Poorly formed string literal: %s" % string)

        def replace(match):
            value = match.group(0)
            if value == '\\\\':
                return '\\'
            if value == '\\"':
                return '"'
            if value == '""':
                return '"'
            if len(value) != 2:
                raise ValueError("Poorly formed string literal: %s" % string)
            return value  # consistent with python handling

        result = re.sub(cls._escaped_quote_re, replace, string[1:-1])
        return result
Removes quotes from a quoted string.

        Splunk search command quote rules are applied. The enclosing
        double-quotes, if present, are removed. Escaped double-quotes ('\"' or
        '""') are replaced by a single double-quote ('"').

        **NOTE**

        We are not using a json.JSONDecoder because Splunk quote rules are
        different than JSON quote rules. A json.JSONDecoder does not recognize
        a pair of double-quotes ('""') as an escaped quote ('"') and will decode
        single-quoted strings ("'") in addition to double-quoted ('"') strings.