def METHOD_NAME(self):
    return ' '.join(
        '%s="%s"' % (k[1:], k[1:] if v is True else htmlescape(v))
        for (k, v) in sorted(self.attributes.items())
        if k.startswith('_') and v is not None)