def get_matching_providers(machines, providers):
    """Get providers managing machines.

    :return: generator yielding tuples of provides instance and
    machines list"""
    for provider in providers:
        common_machines = list(set(provider.machines).intersection(set(
            machines)))
        if len(common_machines) > 0:
            yield provider, common_machines
