def _expand_vrf_spec(self, spec):

        if type(spec) is not dict:
            raise NipapInputError("vrf specification must be a dict")

        allowed_values = ['id', 'name', 'rt']
        for a in spec:
            if a not in allowed_values:
                raise NipapExtraneousInputError("extraneous specification key %s" % a)

        if 'id' in spec:
            if type(spec['id']) not in (int, long):
                raise NipapValueError("VRF specification key 'id' must be an integer.")
        elif 'rt' in spec:
            if type(spec['rt']) != type(''):
                raise NipapValueError("VRF specification key 'rt' must be a string.")
        elif 'name' in spec:
            if type(spec['name']) != type(''):
                raise NipapValueError("VRF specification key 'name' must be a string.")
        if len(spec) > 1:
            raise NipapExtraneousInputError("VRF specification contains too many keys, specify VRF id, vrf or name.")

        where, params = self._sql_expand_where(spec, 'spec_')

        return where, params
Expand VRF specification to SQL.
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/Nipap._expand_vrf_spec