def add_link(self, rel, target, wrap=False, **kwargs):
        """Adds a link to the document.

        This method adds a link to the given ``target`` to the document with
        the given ``rel``. If one or more links are already present for that
        link relationship type, the new link will be added to the existing
        links for that link relationship type.

        Unlike ``dougrain.Document.add_link``, this method does not detect
        equivalence between relationship types with different representations.

        If ``target`` is a string, a link is added with ``target`` as its
        ``href`` property and other properties from the keyword arguments.

        If ``target`` is a ``dougrain.Document`` object, a link is added with
        ``target``'s URL as its ``href`` property and other property from the
        keyword arguments.

        If ``target`` is a ``Builder`` object, a link is added with
        ``target``'s URL as its ``href`` property and other property from the
        keyword arguments.

        This method returns self, allowing it to be chained with additional
        method calls.

        Arguments:

        - ``rel``: a string specifying the link relationship type of the link.
          It should be a well-known link relation name from the IANA registry
          (http://www.iana.org/assignments/link-relations/link-relations.xml),
          a full URI, or a CURIE.
        - ``target``: the destination of the link.
        - ``wrap``: Defaults to False, but if True, specifies that the link
          object should be initally wrapped in a JSON array even if it is the
          first link for the given ``rel``.

        """
        if isinstance(target, bytes):
            target = target.decode('utf-8')
        if isinstance(target, str) and isinstance(target, unicode):
            new_link = dict(href=target, **kwargs)
        else:
            new_link = dict(href=target.url(), **kwargs)

        self._add_rel('_links', rel, new_link, wrap)
        return self
dataset/ETHPy150Open wharris/dougrain/dougrain/builder.py/Builder.add_link/operator `or` -> `and`