<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def where_node_as_ldap(where, compiler, connection):
 """Parse a django.db.models.sql.where.WhereNode. Returns: (clause, [params]):
 the filter clause, with a list of unescaped parameters. """

    bits, params = [], []
    for item in where.children:
        if isinstance(item, WhereNode):
            clause, clause_params = compiler.compile(item)
        else:
            clause, clause_params = item.as_sql(compiler, connection)

        bits.append(clause)
        params.extend(clause_params)

    if not bits:
        return '', []

    # FIXME(rbarrois): shouldn't we flatten recursive AND / OR?
    if len(bits) == 1:
        clause = bits[0]
    elif where.connector == AND:
        clause = '&' + ''.join('(%s)' % bit for bit in bits)
    elif where.connector == OR:
        clause = '|' + ''.join('(%s)' % bit for bit in bits)
    else:
        raise LdapDBError("Unhandled WHERE connector: %s" % where.connector)

    if where.negated:
        clause = ('!(%s)' % clause)

    return clause, params