import _queue


def get(jobs, queue=None):
    """Get results of jobs when they complete.

    Only works on user jobs by default. To work on jobs so someone else,
    initialize a fyrd.queue.Queue class with their user info and pass as an
    argument to queue.

    Parameters
    ----------
    jobs : fyrd.job.Job or list of fyrd.job.Job

    Returns
    -------
    list
        Outputs (STDOUT or return value) of jobs
    queue : fyrd.queue.Queue, optional
        An already initiated Queue class to use.

    .. note:: This function also modifies the input Job objects, so they will
              contain all outputs and state information.
    """
    q = queue if queue else _queue.default_queue()
    return q.get(jobs)