def METHOD_NAME(self, queue_message):
    email_to_addrs_to_resources_map = {}
    targets = queue_message["action"].get("to", [])
    for resource in queue_message["resources"]:
        # this is the list of emails that will be sent for this resource
        resource_emails = []
        for target in targets:
            if target.startswith("tag:") and "tags" in resource:
                tag_name = target.split(":", 1)[1]
                result = resource.get("tags", {}).get(tag_name, None)
                if is_email(result):
                    resource_emails.append(result)
            elif is_email(target):
                resource_emails.append(target)
        resource_emails = tuple(sorted(set(resource_emails)))
        if resource_emails:
            email_to_addrs_to_resources_map.setdefault(resource_emails, []).append(resource)
    if email_to_addrs_to_resources_map == {}:
        self.logger.debug("Found no email addresses, sending no emails.")
    # eg: { ('milton@initech.com', 'peter@initech.com'): [resource1, resource2, etc] }
    return email_to_addrs_to_resources_map