def _get_or_create_subgenre_node(subgenre_name, taxonomy_graph, main_genre_node):
    """
    Return the node for the subgenre if it exists, otherwise create a new node and
    make it a child of the given main genre node.
    """
    if subgenre_name in taxonomy_graph:
        subgenre_node = taxonomy_graph.get_node(subgenre_name)
    else:
        subgenre_node = taxonomy_graph.add_subgenre_node(
            subgenre_name, subgenre_name.title()
        )
        taxonomy_graph.add_genre_to_subgenre_edge(main_genre_node, subgenre_node)

    return subgenre_node