def _unescape(s, uri=False):
out = '<STR_LIT>'<EOL>while len(s) > <NUM_LIT:0>:<EOL><INDENT>c = s[<NUM_LIT:0>]<EOL>if c == '<STR_LIT:\\>':<EOL><INDENT>esc_c = s[<NUM_LIT:1>]<EOL>if esc_c in ('<STR_LIT:u>', '<STR_LIT>'):<EOL><INDENT>out += six.unichr(int(s[<NUM_LIT:2>:<NUM_LIT:6>], base=<NUM_LIT:16>))<EOL>s = s[<NUM_LIT:6>:]<EOL>continue<EOL><DEDENT>else:<EOL><INDENT>if esc_c == '<STR_LIT:b>':<EOL><INDENT>out += '<STR_LIT>'<EOL><DEDENT>elif esc_c == '<STR_LIT:f>':<EOL><INDENT>out += '<STR_LIT>'<EOL><DEDENT>elif esc_c == '<STR_LIT:n>':<EOL><INDENT>out += '<STR_LIT:\n>'<EOL><DEDENT>elif esc_c == '<STR_LIT:r>':<EOL><INDENT>out += '<STR_LIT:\r>'<EOL><DEDENT>elif esc_c == '<STR_LIT:t>':<EOL><INDENT>out += '<STR_LIT:\t>'<EOL><DEDENT>else:<EOL><INDENT>if uri and (esc_c == '<STR_LIT:#>'):<EOL><INDENT>out += '<STR_LIT:\\>'<EOL><DEDENT>out += esc_c<EOL><DEDENT>s = s[<NUM_LIT:2>:]<EOL>continue<EOL><DEDENT><DEDENT>else:<EOL><INDENT>out += c<EOL>s = s[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>return out<EOL>
Iterative parser for string escapes.