'A static helper function for subclasses to add extra authentication
system properties onto a class::
class FooAuthenticate(WWWAuthenticate):
special_realm = auth_property(\'special_realm\')
For more information have a look at the sourcecode to see how the
regular properties (:attr:`realm` etc.) are implemented.'

def auth_property(name, doc=None):

    def _set_value(self, value):
        if (value is None):
            self.pop(name, None)
        else:
            self[name] = str(value)
    return property((lambda x: x.get(name)), _set_value, doc=doc)
