def _convert_exception(e):
    '''Convert an ldap backend exception to an LDAPError and raise it.'''
    args = ('exception in ldap backend: {0}'.format(repr(e)), e)
    if six.PY2:
        six.reraise(LDAPError, args, sys.exc_info()[2])
    else:
        six.raise_from(LDAPError(*args), e)
Convert an ldap backend exception to an LDAPError and raise it.