'if we are to find this ldap object by full distinguished name,
then search by setting search_dn to the \'name\'
rather than by filtering by \'attr\'.'

def _get_search_params(self, name, attr, find_by_dn=False):

    base_dn = self._get_root_dn()
    if find_by_dn:
        search_dn = re.sub('(\\w+=)', (lambda match: match.group(0).upper()), name)
        if (not search_dn.upper().endswith(base_dn.upper())):
            raise LdapSearchException(('Distinguished    Name    provided    does    not    contain    configured    Base    DN.    Base    DN:    %(base_dn)s,    DN:    %(dn)s' % {'base_dn': base_dn, 'dn': search_dn}))
        return (search_dn, '')
    else:
        return (base_dn, (((('(' + attr) + '=') + name) + ')'))
