def unescape_LDAP(ldap_string):
    # type: (str) -> str
    # pylint: disable=C0103
    """
    Unespaces an LDAP string

    :param ldap_string: The string to unescape
    :return: The unprotected string
    """
    if ldap_string is None:
        return None

    if ESCAPE_CHARACTER not in ldap_string:
        # No need to loop
        return ldap_string

    escaped = False
    result = ""

    for character in ldap_string:
        if not escaped and character == ESCAPE_CHARACTER:
            # Escape character found
            escaped = True
        else:
            # Copy the character
            escaped = False
            result += character

    return result
def unescape_LDAP ( ldap_string ) : if ldap_string is None : return None if ESCAPE_CHARACTER not in ldap_string : return ldap_string escaped = False result = "" for character in ldap_string : if not escaped and character == ESCAPE_CHARACTER : escaped = True else : escaped = False result += character return result
Unespaces an LDAP string

    :param ldap_string: The string to unescape
    :return: The unprotected string