def with_resource(resources, function):
    """Yield entered contexts from processing resources in order."""
    for resource in resources:
        with function(resource) as entered:
            yield entered
