def fibonacci(length, a, b):
    """Return the beginning of the fibonacci chain with elements a and b.

    Parameters
    ----------
    length : int
        The length of the chain requested.
    a : object
        The a element of the chain.
    b : object
        The b element of the chain.

    Returns
    -------
    chain : tuple
        A tuple of the requested length, with objects a and b alternating in
        the aperiodic fibonacci pattern.

    """
    if length == 1:
        return (a,)
    if length == 2:
        return (a, b)

    first = (a,)
    second = (a, b)
    while True:
        next = second + first
        if len(next) >= length:
            return next[0:length]
        first = second
        second = next