def collect_defaults(config_spec):
    """Extract the default values from config_spec as a dict of param_name:value.

    Inputs:
        config_spec: list of tuples of format (param_name, conversion_function, default),
            where default = None means no default.
        
    Outputs:
        defaults: dict of param_name:default_value, only where a default was specified.
    """

    defaults = {}
    for config_tup in filter(lambda t: t[2] is not None, config_spec):
        defaults[config_tup[0]] = config_tup[2]
    return defaults