def attrib(context=None, **kwargs):
    """Create a new attribute with context."""
    kwargs.setdefault('metadata', {})
    kwargs['metadata'][KEY] = context
    return attr.ib(**kwargs)
def attrib ( context = None , ** kwargs ) : kwargs . setdefault ( 'metadata' , { } ) kwargs [ 'metadata' ] [ KEY ] = context return attr . ib ( ** kwargs )
Create a new attribute with context.