def namespaces(self, namespaces=None):
    if (not namespaces):
        namespaces = self.nm.namespaces()
    write = self.stream.write
    write('\n')
    for (prefix, namespace) in namespaces:
        if prefix:
            write(('  xmlns:%s="%s"\n' % (prefix, namespace)))
        elif (prefix not in self.extra_ns):
            write(('  xmlns="%s"\n' % namespace))
    for (prefix, namespace) in self.extra_ns.items():
        if prefix:
            write(('  xmlns:%s="%s"\n' % (prefix, namespace)))
        else:
            write(('  xmlns="%s"\n' % namespace))
def namespaces(self, namespaces=None):
    if (not namespaces):
        namespaces = self.nm.namespaces()
    write = self.stream.write
    write('\n')
    for (prefix, namespace) in namespaces:
        if prefix:
            write(('  xmlns:%s="%s"\n' % (prefix, namespace)))
        elif (prefix not in self.extra_ns):
            write(('  xmlns="%s"\n' % namespace))
    for (prefix, namespace) in self.extra_ns.items():
        if prefix:
            write(('  xmlns:%s="%s"\n' % (prefix, namespace)))
        else:
            write(('  xmlns="%s"\n' % namespace))