public function getAttributeFromResults($results, $attr_name) {
        foreach($results as $node) {
        	if($attr_name == "dn") {
        		return $node->getDn();
        	}

            foreach($node->getAttributes() as $attribute) {
                if (strtolower($attribute->getName()) == strtolower($attr_name)) {
                    return $attribute->getValues()[0]; // attribute found
                }
            }
        }
        return null;
    }