import warnings


def multichain(self, *others):
    """Makes self inherit from multiple prototypes.

    Any relationship with previous parent prototypes will be removed.
    When the parent prototypes share attributes with the same name, the
    parent prototype that is first in the list of prototypes will
    provide it.

    Parameters
    ----------
    *others : iterable
        Prototypes to inherit attributes from.

    Returns
    -------
    self : proto
        A proto object that inherits from `others`.

    Raises
    ------
    TypeError
        When trying to chain self to self because it generates a cycle.

    Examples
    --------
    >>> cat = proto(name="cat", meow="meow")
    >>> dog = proto(name="dog", bark="woof")
    >>> catdog = proto(color="orange").multichain(cat, dog)
    >>> catdog.color
    'orange'
    >>> catdog.meow
    'meow'
    >>> catdog.bark
    'woof'
    >>> catdog.name  # first attribute found will be used upon conflict
    'cat'

    .. deprecated:: 0.5.3
       `multichain` will be removed in protoclass 1.0.0, and it will
       be replaced by `chain` because the latter now works with
       multiple prototypes as well.

    """

    warnings.warn(
        "Deprecated since version 0.5.3: `multichain` will be removed in protoclass 1.0.0, and it will be replaced by `chain` because the latter now works with multiple prototypes as well.",
        DeprecationWarning,
    )

    bases = ()
    for other in others:
        bases = bases + (type(other),)
    type(self).__bases__ = type(self).__bases__ + bases
    return self