def autoname_property(attrname):
    """Decorator for creating autoname properties, for use with @autoname

    :param name: Name of the attribute that should hold the property's name

    See :func:`autoname` for usage.

    Under the covers this sets the :token:`_gillcup_autoname_property`
    attribute on the decorated object. This is an implementation detail.
    """
    if not isinstance(attrname, str):
        raise TypeError(
            'Attribute names must be strings. '
            'Did you forget to call @autoname_property with the attrname?')

    def decorator(cls):
        cls._gillcup_autoname_property = attrname
        return cls

    return decorator