def eval_char(c):
    """Returns the character code of the string s, which may contain
    escapes."""
    if len(c) == 1:
        return ord(c)
    elif c[-1] == "'":
        return ord("'")
    elif c[0] == '\\' and c[1] not in 'abtrnvfxuU01234567\\':
        c = c[1:]
    elif c == '\\u':
        return ord('u')
    if len(c) == 1 and ord(c) >= 128:
        return c
    try:
        return ord(eval("b'%s'" % c))
    except TypeError:
        return ord(eval("u'%s'" % c))
