def setAttributeNS(self, namespaceURI, localName, value):
prefix = None<EOL>if namespaceURI:<EOL><INDENT>try:<EOL><INDENT>prefix = self.getPrefix(namespaceURI)<EOL><DEDENT>except KeyError as ex:<EOL><INDENT>prefix = '<STR_LIT>'<EOL>self.setNamespaceAttribute(prefix, namespaceURI)<EOL><DEDENT><DEDENT>qualifiedName = localName<EOL>if prefix:<EOL><INDENT>qualifiedName = '<STR_LIT>' %(prefix, localName)<EOL><DEDENT>self._setAttributeNS(namespaceURI, qualifiedName, value)<EOL>
Keyword arguments:
    namespaceURI -- namespace of attribute to create, None is for
        attributes in no namespace.
    localName -- local name of new attribute
    value -- value of new attribute