def extract_prefix_attr(cls, req):
        """ Extract prefix attributes from arbitary dict.
        """

        # TODO: add more?
        attr = {}
        if 'id' in req:
            attr['id'] = int(req['id'])
        if 'prefix' in req:
            attr['prefix'] = req['prefix']
        if 'pool' in req:
            attr['pool_id'] = int(req['pool'])
        if 'node' in req:
            attr['node'] = req['node']
        if 'type' in req:
            attr['type'] = req['type']
        if 'country' in req:
            attr['country'] = req['country']
        if 'indent' in req:
            attr['indent'] = req['indent']

        return attr
def extract_prefix_attr ( cls , req ) : attr = { } if 'id' in req : attr [ 'id' ] = int ( req [ 'id' ] ) if 'prefix' in req : attr [ 'prefix' ] = req [ 'prefix' ] if 'pool' in req : attr [ 'pool_id' ] = int ( req [ 'pool' ] ) if 'node' in req : attr [ 'node' ] = req [ 'node' ] if 'type' in req : attr [ 'type' ] = req [ 'type' ] if 'country' in req : attr [ 'country' ] = req [ 'country' ] if 'indent' in req : attr [ 'indent' ] = req [ 'indent' ] return attr
Extract prefix attributes from arbitary dict.