def reference(object, callback=None, **annotations):
 if callable(object):
  weak = callable_reference(object, callback)
 else:
  weak = annotatable_weakref(object, callback)
 for (key, value) in annotations.items():
  setattr(weak, key, value)
 return weak

def reference ( object , callback = None , ** annotations ) : if callable ( object ) : weak = callable_reference ( object , callback ) else : weak = annotatable_weakref ( object , callback ) for ( key , value ) in annotations . items ( ) : setattr ( weak , key , value ) return weak
return an annotated weak ref .