def _expand_prefix_spec(self, spec, prefix = '<STR_LIT>'):
<EOL>if type(spec) is not dict:<EOL><INDENT>raise NipapInputError('<STR_LIT>')<EOL><DEDENT>for key in spec.keys():<EOL><INDENT>if key not in _prefix_spec:<EOL><INDENT>raise NipapExtraneousInputError("<STR_LIT>" + key + "<STR_LIT>")<EOL><DEDENT><DEDENT>where = "<STR_LIT>"<EOL>params = {}<EOL>if '<STR_LIT:id>' in spec:<EOL><INDENT>if spec != {'<STR_LIT:id>': spec['<STR_LIT:id>']}:<EOL><INDENT>raise NipapExtraneousInputError("<STR_LIT>")<EOL><DEDENT><DEDENT>family = None<EOL>if '<STR_LIT>' in spec:<EOL><INDENT>family = spec['<STR_LIT>']<EOL>del(spec['<STR_LIT>'])<EOL><DEDENT>spec2 = {}<EOL>for k in spec:<EOL><INDENT>spec2[prefix + k] = spec[k]<EOL><DEDENT>spec = spec2<EOL>if prefix + '<STR_LIT>' in spec:<EOL><INDENT>if spec[prefix + '<STR_LIT>'] is None:<EOL><INDENT>spec[prefix + '<STR_LIT>'] = <NUM_LIT:0><EOL><DEDENT><DEDENT>if prefix + '<STR_LIT>' in spec:<EOL><INDENT>spec['<STR_LIT>'] = spec[prefix + '<STR_LIT>']<EOL>del(spec[prefix + '<STR_LIT>'])<EOL><DEDENT>if prefix + '<STR_LIT>' in spec:<EOL><INDENT>spec['<STR_LIT>'] = spec[prefix + '<STR_LIT>']<EOL>del(spec[prefix + '<STR_LIT>'])<EOL><DEDENT>if prefix + '<STR_LIT>' in spec:<EOL><INDENT>spec['<STR_LIT>'] = spec[prefix + '<STR_LIT>']<EOL>del(spec[prefix + '<STR_LIT>'])<EOL><DEDENT>where, params = self._sql_expand_where(spec)<EOL>if family:<EOL><INDENT>if len(params) == <NUM_LIT:0>:<EOL><INDENT>where = "<STR_LIT>" + prefix + "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>where += "<STR_LIT>" + prefix + "<STR_LIT>"<EOL><DEDENT>params['<STR_LIT>'] = family<EOL><DEDENT>self._logger.debug("<STR_LIT>" % (where, unicode(params)))<EOL>return where, params<EOL>
Expand prefix specification to SQL.