

def unescape(item):
    if (not isinstance(item, basestring)):
        return item
    result = []
    unprocessed = item
    while True:
        res = _ESCAPE_RE.search(unprocessed)
        if (res is None):
            result.append(unprocessed)
            break
        result.append(unprocessed[:res.start()])
        escapes = res.group(1)
        nextchars = res.group(2)
        unprocessed = unprocessed[res.end():]
        result.append(('\\' * (len(escapes) / 2)))
        if (((len(escapes) % 2) == 0) or (len(nextchars) == 0) or (nextchars[0] not in ['n', 'r', 't'])):
            result.append(nextchars)
        elif (nextchars[0] == 'n'):
            if ((len(nextchars) == 1) or (nextchars[1] == ' ')):
                result.append('\n')
            else:
                result.append(('\n' + escapes[1]))
        elif (nextchars[0] == 'r'):
            result.append(('\r' + nextchars[1:]))
        else:
            result.append(('\t' + nextchars[1:]))
    return ''.join(result)

dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/utils/escaping.py unescape/VarMisuse@237/272 `nextchars`->`escapes`