user = ldap_connection.search_s("dc=example,dc=org", ldap.SCOPE_SUBTREE, search_filter)
return user[0]
----
=== How does this work?
include::../../common/fix/validation.adoc[]
For Python, the python-ldap library functions
https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap-filter.html[`escape_filter_chars`] and
https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap-dn.html?highlight=escape_dn#ldap.dn.escape_dn_chars[`escape_dn_chars`] allow sanitizing these characters.
In the compliant solution example, the `escape_filter_chars`
is used to sanitize the search filter concatenated input.