def _expand_pool_spec(self, spec):

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

        allowed_values = ['id', 'name' ]
        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 (long, int):
                raise NipapValueError("pool specification key 'id' must be an integer")
            if spec != { 'id': spec['id'] }:
                raise NipapExtraneousInputError("pool specification with 'id' should not contain anything else")
        elif 'name' in spec:
            if type(spec['name']) != type(''):
                raise NipapValueError("pool specification key 'name' must be a string")
            if 'id' in spec:
                raise NipapExtraneousInputError("pool specification contain both 'id' and 'name', specify pool id or name")

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

        return where, params
Expand pool specification to sql.
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/Nipap._expand_pool_spec