Stream logs from a Docker container within a timeout.

    :param ~docker.models.containers.Container container:
        Container who's log lines to stream.
    :param timeout:
        Timeout value in seconds.
    :param logs_kwargs:
        Additional keyword arguments to pass to ``container.logs()``. For
        example, the ``stdout`` and ``stderr`` boolean arguments can be used to
        determine whether to stream stdout or stderr or both (the default).

    :raises TimeoutError:
        When the timeout value is reached before the logs have completed.

def stream_logs(container, timeout=10.0, **logs_kwargs):
    """
    Stream logs from a Docker container within a timeout.

    :param ~docker.models.containers.Container container:
        Container who's log lines to stream.
    :param timeout:
        Timeout value in seconds.
    :param logs_kwargs:
        Additional keyword arguments to pass to ``container.logs()``. For
        example, the ``stdout`` and ``stderr`` boolean arguments can be used to
        determine whether to stream stdout or stderr or both (the default).

    :raises TimeoutError:
        When the timeout value is reached before the logs have completed.
    """
    stream = container.logs(stream=True, **logs_kwargs)
    return stream_timeout(
        stream, timeout, 'Timeout waiting for container logs.')