Find an entry in a subgraph by name. Any mapping that implements
    .items() and maps unique id -> something can be used as the subgraph.

    Names are like:
        '{nodetype}.{target_package}.{target_name}'

    You can use `None` for the package name as a wildcard.

def find_in_subgraph_by_name(subgraph, target_name, target_package, nodetype):
    """Find an entry in a subgraph by name. Any mapping that implements
    .items() and maps unique id -> something can be used as the subgraph.

    Names are like:
        '{nodetype}.{target_package}.{target_name}'

    You can use `None` for the package name as a wildcard.
    """
    for name, model in subgraph.items():
        if id_matches(name, target_name, target_package, nodetype, model):
            return model

    return None