def _get_even_or_odd_nodes(graph, mod):
    """
    Helper function for get_even_nodes.  Given a networkx object, return names of the odd or even nodes
    Args:
        graph (networkx graph): determine the degree of nodes in this graph
        mod (int): 0 for even, 1 for odd

    Returns:
        list[str]: list of node names of odd or even degree
    """
    degree_nodes = []
    for v, d in graph.degree():
        if d % 2 == mod:
            degree_nodes.append(v)
    return degree_nodes