def _try_weakref(arg, remove_callback):
 try:
  arg = weakref.ref(arg, remove_callback)
 except TypeError:
  pass
 return arg

def _try_weakref ( arg , remove_callback ) : try : arg = weakref . ref ( arg , remove_callback ) except TypeError : pass return arg
return a weak reference to arg if possible .