(user)
return namedtuple('user', list(user))(**user)
Takes a flat dict and returns an object
Takes a flat dict and returns an object
Takes a flat dict and returns an object
def to_obj(user):
        '''
        Takes a flat dict and returns an object
        '''
        if '_id' in user:
            user['id'] = user.pop('_id')
        return namedtuple('user', list(user))(**user)
def to_obj ( user ) : if '_id' in user : user [ 'id' ] = user . pop ( '_id' ) return namedtuple ( 'user' , list ( user ) ) ( * * user )