def check_cyclic_flow(self, socket_a, socket_b):
        """Check whether connecting sockets form a cycle.

        Works by checking whether the input socket is
        somehow already connected to the output socket
        by being part of a node that ends up feeding the
        output socket in the first place. Such kind of
        connections is forbidden, as it creates a cycle
        in the data flow, preventing the data from
        advancing in the graph.

        So, if such kind of connection is detected,
        we raise a ValueError to prevent the connection
        from existing and thereby causing a cycle.
        """
        ### retrieve the node from the socket a
        node = socket_a.node

        ### check whether socket_b has the same node of
        ### socket_a, raising a ValueError if so, since
        ### connecting the sockets in this circunstance
        ### would create a cycle in the data flow

        if socket_b.node is node:

            raise ValueError(
                "Connecting given sockets would create a" " cycle in the data flow"
            )

        ### keep checking the parents of the input sockets
        ### further up in the node layout branch until all
        ### existing "ancestors" are checked

        for input_socket in node.input_sockets:

            ## check whether the input socket has a parent
            try:
                parent = input_socket.parent

            ## if not, that's ok, just pass
            except AttributeError:
                pass

            ## otherwise keep checking the input
            ## sockets embedded in the parent's node
            ## recursively until no "ancestors" are
            ## left
            else:
                self.check_cyclic_flow(
                    parent,
                    socket_b,
                )
Check whether connecting sockets form a cycle.

        Works by checking whether the input socket is
        somehow already connected to the output socket
        by being part of a node that ends up feeding the
        output socket in the first place. Such kind of
        connections is forbidden, as it creates a cycle
        in the data flow, preventing the data from
        advancing in the graph.

        So, if such kind of connection is detected,
        we raise a ValueError to prevent the connection
        from existing and thereby causing a cycle.
        
nodezator/graphman/socketparenthood/support.py