def create_ldap_connection(host):
    '\n    Creates an LDAP connection object with a given hostname\n\n    Parameters\n    ----------\n    host : hostname with the LDAP database in the form of (ldap://host)\n\n    Returns\n    -------\n    LDAP connection object\n    '
    connection = ldap.initialize(host)
    connection.set_option(ldap.OPT_REFERRALS, 0)
    connection.simple_bind_s()
    return connection
Creates an LDAP connection object with a given hostname

Parameters
----------
host : hostname with the LDAP database in the form of (ldap://host)

Returns
-------
LDAP connection object
def create_ldap_connection(host):
    '\n    Creates an LDAP connection object with a given hostname\n\n    Parameters\n    ----------\n    host : hostname with the LDAP database in the form of (ldap://host)\n\n    Returns\n    -------\n    LDAP connection object\n    '
    connection = ldap.initialize(host)
    connection.set_option(ldap.OPT_REFERRALS, 0)
    connection.simple_bind_s()
    return connection