def parse_row(row):
    """For a single rule (row), create acceptable input for nx.build_edges_from()"""
    parent, children = row.split(" bags contain ")
    parsed_children = []
    if children != "no other bags.":
        children = children.replace("bags", "").split(", ")
        for child in children:     
            num, adj, color = child.split(" ")[:3]
            name = adj + " " + color
            parsed_children.append((parent, name, {'max_count': int(num)}))
    return {parent: parsed_children}