def unquoteStr(astr, escChar='\\', quoteChars='"\''):
    """Remove quotes from a string and unescapes contained escaped quotes.
    
    Based on email.unquote.
    """
    if len(astr) > 1:
        for quoteChar in quoteChars:
            if astr.startswith(quoteChar) and astr.endswith(quoteChar):
                return astr[1:-1].replace(escChar + escChar, escChar).replace(
                    escChar + quoteChar, quoteChar)
    return astr
