def autoname(cls):
    """Decorator that automatically names class items with autoname properties
    An autoname property is made with the :func:`autoname_property` decorator,
    like this::

        >>> @autoname_property('name')
        ... class MyDescriptor:
        ...     def __get__(self, instance, owner=None):
        ...         if instance is None:
        ...             return self
        ...         else:
        ...             return '<{} of {}>'.format(self.name, instance)

        >>> @autoname
        ... class Spaceship:
        ...     position = MyDescriptor()
        ...     velocity = MyDescriptor()

        >>> Spaceship().position
        '<position of <...Spaceship object at ...>>'
        >>> Spaceship().velocity
        '<velocity of <...Spaceship object at ...>>'
    """
    for name, value in cls.__dict__.items():
        name_prop = getattr(type(value), '_gillcup_autoname_property', None)
        if name_prop is not None:
            setattr(value, name_prop, name)
    return cls