'Strip quotes of doctests output values:
>>> o = OutputChecker()
>>> o._strip_quotes("\'foo\'")
"foo"
>>> o._strip_quotes(\'"foo"\')
"foo"
>>> o._strip_quotes("u\'foo\'")
"foo"
>>> o._strip_quotes(\'u"foo"\')
"foo"'

def _strip_quotes(self, want, got):

    def is_quoted_string(s):
        s = s.strip()
        return ((len(s) >= 2) and (s[0] == s[(-1)]) and (s[0] in ('"', "'")))
    def is_quoted_unicode(s):
        s = s.strip()
        return ((len(s) >= 3) and (s[0] == 'u') and (s[1] == s[(-1)]) and (s[1] in ('"', "'")))
    if (is_quoted_string(want) and is_quoted_string(got)):
        want = want.strip()[1:(-1)]
        got = got.strip()[1:(-1)]
    elif (is_quoted_unicode(want) and is_quoted_unicode(got)):
        want = want.strip()[2:(-1)]
        got = got.strip()[2:(-1)]
    return (want, got)
