def output(output_name, product_index=0):
    """Return a selector function for a specified output of a product.

    :param output_name: the name of the output to select
    :param product_index: which product's outputs to look in
    """
    return lambda facility: facility.products[product_index].outputs[output_name]