def search_pool(self, auth, query, search_options=None):
if search_options is None:<EOL><INDENT>search_options = {}<EOL><DEDENT>if '<STR_LIT>' not in search_options:<EOL><INDENT>search_options['<STR_LIT>'] = <NUM_LIT:50><EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>search_options['<STR_LIT>'] = int(search_options['<STR_LIT>'])<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>raise NipapValueError('<STR_LIT>' +<EOL>'''<STR_LIT>''')<EOL><DEDENT><DEDENT>if '<STR_LIT>' not in search_options:<EOL><INDENT>search_options['<STR_LIT>'] = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>search_options['<STR_LIT>'] = int(search_options['<STR_LIT>'])<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>raise NipapValueError('<STR_LIT>' +<EOL>'''<STR_LIT>''')<EOL><DEDENT><DEDENT>self._logger.debug('<STR_LIT>' % unicode(search_options))<EOL>where, opt = self._expand_pool_query(query)<EOL>sql = """<STR_LIT>""" + where + """<STR_LIT>""" + unicode(search_options['<STR_LIT>']) + """<STR_LIT>""" + unicode(search_options['<STR_LIT>'])<EOL>self._execute(sql, opt)<EOL>result = list()<EOL>for row in self._curs_pg:<EOL><INDENT>result.append(dict(row))<EOL><DEDENT>return { '<STR_LIT>': search_options, '<STR_LIT:result>': result }<EOL>
Search pool list for pools matching `query`.

            * `auth` [BaseAuth]
                AAA options.
            * `query` [dict_to_sql]
                How the search should be performed.
            * `search_options` [options_dict]
                Search options, see below.

            Returns a list of dicts.

            The `query` argument passed to this function is designed to be
            able to specify how quite advanced search operations should be
            performed in a generic format. It is internally expanded to a SQL
            WHERE-clause.

            The `query` is a dict with three elements, where one specifies the
            operation to perform and the two other specifies its arguments. The
            arguments can themselves be `query` dicts, to build more complex
            queries.

            The :attr:`operator` key specifies what operator should be used for the
            comparison. Currently the following operators are supported:

            * :data:`and` - Logical AND
            * :data:`or` - Logical OR
            * :data:`equals` - Equality; =
            * :data:`not_equals` - Inequality; !=
            * :data:`like` - SQL LIKE
            * :data:`regex_match` - Regular expression match
            * :data:`regex_not_match` - Regular expression not match

            The :attr:`val1` and :attr:`val2` keys specifies the values which are subjected
            to the comparison. :attr:`val1` can be either any pool attribute or an
            entire query dict. :attr:`val2` can be either the value you want to
            compare the pool attribute to, or an entire `query` dict.

            Example 1 - Find the pool whose name match 'test'::

                query = {
                    'operator': 'equals',
                    'val1': 'name',
                    'val2': 'test'
                }

            This will be expanded to the pseudo-SQL query::

                SELECT * FROM pool WHERE name = 'test'

            Example 2 - Find pools whose name or description regex matches 'test'::

                query = {
                    'operator': 'or',
                    'val1': {
                        'operator': 'regex_match',
                        'val1': 'name',
                        'val2': 'test'
                    },
                    'val2': {
                        'operator': 'regex_match',
                        'val1': 'description',
                        'val2': 'test'
                    }
                }

            This will be expanded to the pseudo-SQL query::

                SELECT * FROM pool WHERE name ~* 'test' OR description ~* 'test'

            The search options can also be used to limit the number of rows
            returned or set an offset for the result.

            The following options are available:
                * :attr:`max_result` - The maximum number of pools to return (default :data:`50`).
                * :attr:`offset` - Offset the result list this many pools (default :data:`0`).

            This is the documentation of the internal backend function. It's
            exposed over XML-RPC, please also see the XML-RPC documentation for
            :py:func:`nipap.xmlrpc.NipapXMLRPC.search_pool` for full
            understanding.