def transform_prop(world, db, val):
    if type(val) is not dict:
        return val
    key = val.get('type', None)

    if key == 'editstr':
        if val in 'editaccess':
            val['editaccess'] = twcommon.access.level_named(val['editaccess'])
    
    if key == 'portlist':
        if val['plistkey'] in world.portlistmap:
            plistid = world.portlistmap[val['plistkey']]['_id']
        else:
            plistid = db.portlists.insert({'type':'world', 'wid':world.wid, 'key':val['plistkey']})
            print('Created portlist %s (%s)' % (val['plistkey'], plistid,))
        # Clean out the portlist and rebuild it
        db.portals.remove({'plistid':plistid, 'iid':None})
        listpos = 0.0
        portid = None
        for quad in val['_templist']:
            tocreator = db.players.find_one({'name':quad[1]})
            if not tocreator:
                error('Creator not found for portal: %s, %s' % (quad[0], quad[1]))
                return '[Portal world creator not found]'
            toworld = db.worlds.find_one({'name':quad[0], 'creator':tocreator['_id']})
            if not toworld:
                error('World not found for portal: %s' % (quad[0],))
                return '[Portal world not found]'
            toloc = db.locations.find_one({'wid':toworld['_id'], 'key':quad[3]})
            if not toloc:
                error('Location not found for portal: %s, %s' % (quad[0], quad[3]))
                return '[Portal location not found]'
            query = { 'plistid':plistid, 'iid':None, 'wid':toworld['_id'], 'locid':toloc['_id'] }
            if quad[2] in ('personal', 'global', 'same'):
                query['scid'] = quad[2]
            else:
                query['scid'] = ObjectId(quad[2])
            query['listpos'] = listpos
            listpos += 1.0
            portid = db.portals.insert(query)
            print('Created portal %s (%s)' % (quad, portid,))
        newval = { 'type':'portlist', 'plistkey':val['plistkey'] }
        if 'text' in val:
            newval['text'] = val['text']
        if 'focus' in val:
            newval['focus'] = True
        if 'editaccess' in val:
            newval['editaccess'] = twcommon.access.level_named(val['editaccess'])
        if 'readaccess' in val:
            newval['readaccess'] = twcommon.access.level_named(val['readaccess'])
        return newval
            
    
    return val
dataset/ETHPy150Open erkyrath/tworld/twloadworld.py/transform_prop/swapped operands of `in`