def get_nodes_by_type(ntwrk, typ='switch'):
    """
    Return a dictionary of nodes (in ntwrk) whose 'type' matches 'typ'.
    """
    return {k: v for el in ntwrk
                  for k, v in el.items() if v['type'] == typ}