code: def to_format(self, attr):
          
          try:
              _attr = self._to[attr]
          except KeyError:
              try:
                  _attr = self._to[attr.lower()]
              except:
                  _attr = ''
  
          if _attr:
              return factory(saml.Attribute,
                             name=_attr,
                             name_format=self.name_format,
                             friendly_name=attr)
          else:
              return factory(saml.Attribute, name=attr)
docs: Creates an Attribute instance with name, name_format and
          friendly_name
  
          :param attr: The local name of the attribute
          :return: An Attribute instance