def pulse_source_info(source, volume=False, verbose=False):
    """
    Generates a dictionary from the PulseSourceInfo object.

    :param source: the PulseSourceInfo object to use
    :type source: pulsectl.PulseSourceInfo
    :param volume: whether to include the (average) volume across all channels
    :type volume: bool
    :param verbose: whether to generate a verbose result
    :type verbose: bool
    :return: dictionary of info
    :rtype: dict
    """

    result = {}

    if verbose:
        result['device'] = {}
        result['device']['name'] = source.name
        result['device']['description'] = source.description
        if volume:
            result['device']['volume'] = source.volume.value_flat
        if source.port_active is not None:
            result['port'] = {}
            result['port']['name'] = source.port_active.name
            result['port']['description'] = source.port_active.description
    else:
        result['device'] = source.description
        if source.port_active is not None:
            result['port'] = source.port_active.description
        if volume:
            result['volume'] = source.volume.value_flat

    return result