def decode(arg, delimiter=None, encodeseq=None):
    '''Decode a single argument from the file-system'''
    arg = coerce_unicode(arg, _c.FSQ_CHARSET)
    new_arg = sep = u''
    delimiter, encodeseq = delimiter_encodeseq(
        _c.FSQ_DELIMITER if delimiter is None else delimiter,
        _c.FSQ_ENCODE if encodeseq is None else encodeseq,
        _c.FSQ_CHARSET)

    # char-wise decode walk -- minimally stateful
    encoding_trg = sep
    for c in arg:
        if len(encoding_trg):
            encoding_trg = sep.join([encoding_trg, c])
            if 4 !=  len(encoding_trg):
                continue
            try:
                c = chr(int(encoding_trg, 16))
            except __HOLE__:
                raise FSQEncodeError(errno.EINVAL, u'invalid decode'\
                                     u' target: {0}'.format(encoding_trg))
            c = coerce_unicode(c, _c.FSQ_CHARSET)
            encoding_trg = sep
        elif c == encodeseq:
            encoding_trg = u'0x'
            continue

        new_arg = sep.join([new_arg, c])

    # edge case, incomplete encoding at end of string
    if len(encoding_trg):
        raise FSQEncodeError(errno.EINVAL, u'truncated encoding at end of'
                             u' argument: {0}'.format(encoding_trg))

    return new_arg
dataset/ETHPy150Open axialmarket/fsq/fsq/encode.py/decode