Checking if object is managed

Is there a function for checking whether an object is managed?

This way, when doing a record update, one can check for the objects status.
If it is managed, then
  call the "Merge" function
  call the "Update" function
call "Flush"


if Manager.IsAttached(Customer) then ...
Note that if you call Merge when object is in the manager, it just returns the managed object. So probably you don't need to do such checks?