code: def to_(self, attrvals):
          
          attributes = []
          for key, value in attrvals.items():
              name = self._to.get(key.lower())
              if name:
                  if name == "urn:oid:1.3.6.1.4.1.5923.1.1.1.10":
                      # special case for eduPersonTargetedID
                      attr_value = []
                      for v in value:
                          extension_element = ExtensionElement("NameID", NAMESPACE,
                                                               attributes={'Format': NAMEID_FORMAT_PERSISTENT}, text=v)
                          attrval = saml.AttributeValue(extension_elements=[extension_element])
                          attr_value.append(attrval)
                  else:
                      attr_value = do_ava(value)
                  attributes.append(factory(saml.Attribute,
                                            name=name,
                                            name_format=self.name_format,
                                            friendly_name=key,
                                            attribute_value=attr_value))
              else:
                  attributes.append(factory(saml.Attribute,
                                            name=key,
                                            attribute_value=do_ava(value)))
  
          return attributes
docs: Create a list of Attribute instances.
  
          :param attrvals: A dictionary of attributes and values
          :return: A list of Attribute instances