u"""Use curly quotes, not straight quotes.
978182
def check_curly_quotes(text):
    """
    err = "typography.symbols.curly_quotes"
    msg = u'Use curly quotes “”, not straight quotes "".'

    list = [
        [u"“ or ”", ['"']],
    ]

    return preferred_forms_check(
        text, list, err, msg, ignore_case=False, max_errors=2)
227576
def _escape(self, value):
        """"""
        if isinstance(value, SafeString):
            return value

        return shellescape.quote(value)
183597
def escape(str):
    """"""
    out = ''
    for char in str:
        if char in '\\ ':
            out += '\\'
        out += char
    return out
1343010
def quoted_string_literal(txt):
    
    try:
        return "'%s'" % (txt.replace("\\", "\\\\").replace("'", "\\'"),)
    except TypeError:
        raise NotSupportedError("Cannot quote %r objects: %r" % (type(txt), txt))
570654
def is_quoted(position, text):
    """"""
    def matching(quotemark1, quotemark2):
        straight = '\"\''
        curly = '“”'
        if quotemark1 in straight and quotemark2 in straight:
            return True
        if quotemark1 in curly and quotemark2 in curly:
            return True
        else:
            return False

    def find_ranges(text):
        s = 0
        q = pc = ''
        start = None
        ranges = []
        seps = " .,:;-\r\n"
        quotes = ['\"', '“', '”', "'"]
        for i, c in enumerate(text + "\n"):
            if s == 0 and c in quotes and pc in seps:
                start = i
                s = 1
                q = c
            elif s == 1 and matching(c, q):
                s = 2
            elif s == 2:
                if c in seps:
                    ranges.append((start+1, i-1))
                    start = None
                    s = 0
                else:
                    s = 1
            pc = c
        return ranges

    def position_in_ranges(ranges, position):
        for start, end in ranges:
            if start <= position < end:
                return True
        return False

    return position_in_ranges(find_ranges(text), position)
869553
public static void quote(StringBuilder buf, String str) {
        buf.append('"');
        escape(buf, str);
        buf.append('"');
    }
93088
def unquote(s):
    """"""
    res = s.split('%')
    # fastpath
    if len(res) == 1:
        return s
    s = res[0]
    for item in res[1:]:
        try:
            s += _hextochr[item[:2]] + item[2:]
        except KeyError:
            s += '%' + item
        except UnicodeDecodeError:
            s += chr(int(item[:2], 16)) + item[2:]
    return s
421629
def dequote(s):
        """"""
        if len(s) < 2:
            return s
        elif (s[0] == s[-1]) and s.startswith(('"', "'")):
            return s[1: -1]
        else:
            return s
795741
def _indent(indent=0, quote='', indent_char=' '):
    """"""
    if indent > 0:
        indent_string = ''.join((
            str(quote),
            (indent_char * (indent - len(quote)))
        ))
    else:
        indent_string = ''.join((
            ('\x08' * (-1 * (indent - len(quote)))),
            str(quote))
        )

    if len(indent_string):
        INDENT_STRINGS.append(indent_string)
454550
def unquote(s):
  """"""
  # Ignore the left- and rightmost chars (which should be quotes).
  # Use the Python engine to decode the escape sequence
  i, N = 1, len(s) - 1
  ret = []
  while i < N:
    if s[i] == '\\' and i < N - 1:
      ret.append(UNQUOTE_MAP.get(s[i+1], s[i+1]))
      i += 2
    else:
      ret.append(s[i])
      i += 1
  return ''.join(ret)
822321
def _unquote(self, value):
        """"""
        if not value:
            # should only happen during parsing of lists
            raise SyntaxError
        if (value[0] == value[-1]) and (value[0] in ('"', "'")):
            value = value[1:-1]
        return value
520003
function usesExpectedQuotes(node) {
            return node.value.indexOf(setting.quote) !== -1 || astUtils.isSurroundedBy(node.raw, setting.quote);
        }
891407
def inline(self):
        """"""
        tp_lines, tp_decl = self.get_decl_pair()
        tp_lines = " ".join(tp_lines)
        if tp_decl is None:
            return tp_lines
        else:
            return "%s %s" % (tp_lines, tp_decl)
1294766
def escape_b(s, quote=True):
    ''''''
    s = s.replace(b"&", b"&amp;") # Must be done first!
    s = s.replace(b"<", b"&lt;")
    s = s.replace(b">", b"&gt;")
    if quote:
        s = s.replace(b'"', b"&quot;")
    return s
445885
def quote(s, unsafe='/'):
    """"""
    res = s.replace('%', '%25')
    for c in unsafe:
        res = res.replace(c, '%' + (hex(ord(c)).upper())[2:])
    return res
716014
private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {

        if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
            return s;
        }

        StringBuilder b = new StringBuilder();
        for (int i = beginIndex; i < endIndex; i++) {
            char c = s.charAt(i);
            if (c == '\\' ) {
                b.append(c);
                //ignore the character after an escape, just append it
                if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
                b.append(s.charAt(i));
            } else if (c == '"')
                b.append('\\').append('"');
            else
                b.append(c);
        }

        return b.toString();
    }
175537
def _quote(str, LegalChars=_LegalChars):
    
    """
    if all(c in LegalChars for c in str):
        return str
    else:
        return '"' + _nulljoin(_Translator.get(s, s) for s in str) + '"'