def _sql_expand_where(self, spec, key_prefix = '', col_prefix = ''):

        sql = ' AND '.join(col_prefix + key +
            ( ' IS ' if spec[key] is None else ' = ' ) +
            '%(' + key_prefix + key + ')s' for key in spec)
        params = {}
        for key in spec:
            params[key_prefix + key] = spec[key]

        return sql, params



    # TODO: make this more generic and use for testing of spec too?
Expand a dict so it fits in a WHERE clause
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/Nipap._sql_expand_where