<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group(self, base_dn, samaccountname, attributes=(), explicit_membership_only=False):
 """Produces a single, populated ADGroup object through the object factory. Does not populate attributes for the caller instance. sAMAccountName may not be present in group objects in modern AD schemas. Searching by common name and object class (group) may be an alternative approach if required in the future. :param str base_dn: The base DN to search within :param str samaccountname: The group's sAMAccountName :param list attributes: Object attributes to populate, defaults to all :return: A populated ADGroup object :rtype: ADGroup """


        groups = self.groups(base_dn, samaccountnames=[samaccountname], attributes=attributes,
                             explicit_membership_only=explicit_membership_only)

        try:
            # Usually we will find a match, but perhaps not always
            return groups[0]
        except IndexError:
            logging.info("%s - unable to retrieve object from AD by sAMAccountName", samaccountname)