def prop_to_string(val):
    if type(val) is not dict:
        return repr(val)
    key = val.get('type', None)
    if key == 'move':
        return '*move %s' % (val['loc'],)
    if key == 'focus':
        return '*focus %s' % (val['key'],)
    if key == 'event':
        res = '*event %s' % (val['text'],)
        if 'otext' in val:
            res += ('\n\t- otext: ' + val['otext'])
        return res
    if key == 'panic':
        res = '*panic %s' % (val['text'],)
        if 'otext' in val:
            res += ('\n\t- otext: ' + val['otext'])
        return res
    if key == 'selfdesc':
        res = '*selfdesc %s' % (val['text'],)
        return res
    if key == 'text':
        val = val['text']
        if val in '\n\n':
            return val.replace('\n\n', '\n\t')
        return val
    if key == 'gentext':
        val = val['text']
        if '\n' not in text:
            return '*gentext %s' % (text,)
        else:
            ls = [ '  '+val for val in text.split('\n') ]
            text = '\n'.join(ls)
            return '*gentext\n%s' % (text,)
    if key == 'code':
        text = val['text']
        if '\n' not in text:
            return '*code %s' % (text,)
        else:
            ls = [ '  '+val for val in text.split('\n') ]
            text = '\n'.join(ls)
            return '*code\n%s' % (text,)
    return repr(val)
dataset/ETHPy150Open erkyrath/tworld/twloadworld.py/prop_to_string/swapped operands of `in`