'Check if the `link` can be added to the scheme and raise an
appropriate exception.
Can raise:
- :class:`TypeError` if `link` is not an instance of
:class:`.SchemeLink`
- :class:`.SchemeCycleError` if the `link` would introduce a cycle
- :class:`.IncompatibleChannelTypeError` if the channel types are
not compatible
- :class:`.SinkChannelError` if a sink channel has a `Single` flag
specification and the channel is already connected.
- :class:`.DuplicatedLinkError` if a `link` duplicates an already
present link.'

def check_connect(self, link):

    check_type(link, SchemeLink)
    if self.creates_cycle(link):
        raise SchemeCycleError('Cannot    create    cycles    in    the    scheme')
    if (not self.compatible_channels(link)):
        raise IncompatibleChannelTypeError(('Cannot    connect    %r    to    %r.' % (link.source_channel.type, link.sink_channel.type)))
    links = self.find_links(source_node=link.source_node, source_channel=link.source_channel, sink_node=link.sink_node, sink_channel=link.sink_channel)
    if links:
        raise DuplicatedLinkError(('A    link    from    %r    (%r)    ->    %r    (%r)    already    exists' % (link.source_node.title, link.source_channel.name, link.sink_node.title, link.sink_channel.name)))
    if link.sink_channel.single:
        links = self.find_links(sink_node=link.sink_node, sink_channel=link.sink_channel)
        if links:
            raise SinkChannelError(('%r    is    already    connected.' % link.sink_channel.name))
