def get_user_attributes_from_ldap(ldap_connection, ldap_base_dn, login, attribute):
    """returns the user group names, no permissions for now

    :param ldap3.Connection ldap_connection: The ldap_client as ldap3.Connection instance
    :param str ldap_base_dn: The domain name in LDAP format (all this CN, DN stuff)
    :param str login: The login
    :param str attribute: The attribute to query
    """

    result = []
    if ldap_connection:
        ldap_filter = '(sAMAccountName=%s)' % login

        result = ldap_connection.search(
            ldap_base_dn,
            ldap_filter,
            attributes=attribute,
        )
        if result:
            data = ldap_connection.response
            return data[0]['attributes'][attribute]

    return None