Get dependecy cycles from API

There is a way to check if in the file there is a dependecy cycles?
I have to write a script to find dependecy cycles in .blend file, but I can’t find the way to read a possible value from some part of the API.
In the shell console there is the warning, so somewhere there is a property to check that info I think.

Seems relevant: Validating linked data blocks via python - Python Support - Blender Artists Community

Thanks, but the script you linked is a control on load library items, if it not find lib, report the miss library.

I need to search the dependency cycles in the file, the problem is that I do not know where watch.
Two possible solution are:

  1. Get the depsgraph tree in .gv and find the way to looking for dependency cycles.
  2. Using sdtout (very dirty)