<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def MI_associatorNames(self, env, objectName, assocClassName, resultClassName, role, resultRole):
 # pylint: disable=invalid-name """Return instances names associated to a given object. Implements the WBEM operation AssociatorNames in terms of the references method. A derived class will not normally override this method. """


        logger = env.get_logger()
        logger.log_debug('CIMProvider2 MI_associatorNames called. ' \
                         'assocClass: %s' % (assocClassName))
        if not assocClassName:
            raise pywbem.CIMError(
                pywbem.CIM_ERR_FAILED,
                "Empty assocClassName passed to AssociatorNames")
        model = pywbem.CIMInstance(classname=assocClassName)
        model.path = pywbem.CIMInstanceName(classname=assocClassName,
                                            namespace=objectName.namespace)
        gen = self.references(env=env,
                              object_name=objectName,
                              model=model,
                              result_class_name=resultClassName,
                              role=role,
                              result_role=None,
                              keys_only=False)
        if gen is None:
            logger.log_debug('references() returned None instead of ' \
                             'generator object')
            return
        for inst in gen:
            for prop in inst.properties.values():
                lpname = prop.name.lower()
                if prop.type != 'reference':
                    continue
                if role and role.lower() == lpname:
                    continue
                if resultRole and resultRole.lower() != lpname:
                    continue
                if self.paths_equal(prop.value, objectName):
                    continue
                if resultClassName and  \
                        resultClassName.lower() != prop.value.classname.lower():
                    continue
                if prop.value.namespace is None:
                    prop.value.namespace = objectName.namespace
                yield prop.value
        logger.log_debug('CIMProvider2 MI_associatorNames returning')