Converts the external data from "type" to internal

        :type attribute_profile: str
        :type external_dict: dict[str, str]
        :rtype: dict[str, str]

        :param attribute_profile: From which external type to convert (ex: oidc, saml, ...)
        :param external_dict: Attributes in the external format
        :return: Attributes in the internal format

def to_internal(self, attribute_profile, external_dict):
        """
        Converts the external data from "type" to internal

        :type attribute_profile: str
        :type external_dict: dict[str, str]
        :rtype: dict[str, str]

        :param attribute_profile: From which external type to convert (ex: oidc, saml, ...)
        :param external_dict: Attributes in the external format
        :return: Attributes in the internal format
        """
        internal_dict = {}

        for internal_attribute_name, mapping in self.from_internal_attributes.items():
            if attribute_profile not in mapping:
                logger.debug("no attribute mapping found for internal attribute '%s' the attribute profile '%s'" % (
                    internal_attribute_name, attribute_profile))
                # skip this internal attribute if we have no mapping in the specified profile
                continue

            external_attribute_name = mapping[attribute_profile]
            attribute_values = self._collate_attribute_values_by_priority_order(external_attribute_name,
                                                                                external_dict)
            if attribute_values:  # Only insert key if it has some values
                logger.debug("backend attribute '%s' mapped to %s" % (external_attribute_name,
                                                            internal_attribute_name))
                internal_dict[internal_attribute_name] = attribute_values
            else:
                logger.debug("skipped backend attribute '%s': no value found", external_attribute_name)

        internal_dict = self._handle_template_attributes(attribute_profile, internal_dict)
        return internal_dict