def _expand_vrf_query(self, query, table_name = None):
where = unicode()<EOL>opt = list()<EOL>if table_name is None:<EOL><INDENT>col_prefix = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>col_prefix = table_name + "<STR_LIT:.>"<EOL><DEDENT>if type(query['<STR_LIT>']) == dict and type(query['<STR_LIT>']) == dict:<EOL><INDENT>sub_where1, opt1 = self._expand_vrf_query(query['<STR_LIT>'], table_name)<EOL>sub_where2, opt2 = self._expand_vrf_query(query['<STR_LIT>'], table_name)<EOL>try:<EOL><INDENT>where += unicode("<STR_LIT>" % (sub_where1, _operation_map[query['<STR_LIT>']], sub_where2) )<EOL><DEDENT>except KeyError:<EOL><INDENT>raise NipapNoSuchOperatorError("<STR_LIT>" % unicode(query['<STR_LIT>']))<EOL><DEDENT>opt += opt1<EOL>opt += opt2<EOL><DEDENT>else:<EOL><INDENT>if query['<STR_LIT>'] not in _vrf_spec:<EOL><INDENT>raise NipapInputError('<STR_LIT>' % unicode(query['<STR_LIT>']))<EOL><DEDENT>if query['<STR_LIT>'] not in _operation_map:<EOL><INDENT>raise NipapNoSuchOperatorError("<STR_LIT>" % query['<STR_LIT>'])<EOL><DEDENT>if query['<STR_LIT>'] == '<STR_LIT>' and query['<STR_LIT>'] is None:<EOL><INDENT>query['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>elif query['<STR_LIT>'] == '<STR_LIT>' and query['<STR_LIT>'] is None:<EOL><INDENT>query['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if query['<STR_LIT>'] in ('<STR_LIT>',):<EOL><INDENT>where = unicode("<STR_LIT>" %<EOL>( col_prefix, _vrf_spec[query['<STR_LIT>']]['<STR_LIT>'])<EOL>)<EOL><DEDENT>else:<EOL><INDENT>where = unicode("<STR_LIT>" %<EOL>( col_prefix, _vrf_spec[query['<STR_LIT>']]['<STR_LIT>'],<EOL>_operation_map[query['<STR_LIT>']] )<EOL>)<EOL><DEDENT>opt.append(query['<STR_LIT>'])<EOL><DEDENT>return where, opt<EOL>
Expand VRF query dict into a WHERE-clause.

            If you need to prefix each column reference with a table
            name, that can be supplied via the table_name argument.