def nx_ensure_agraph_color(graph):
    from plottool import color_funcs
    import plottool as pt
    def _fix_agraph_color(data):
        try:
            orig_color = data.get('color', None)
            alpha = data.get('alpha', None)
            color = orig_color
            if color is None and alpha is not None:
                color = [0, 0, 0]
            if color is not None:
                color = pt.ensure_nonhex_color(color)
                color = list(color_funcs.ensure_base255(color))
                if alpha is not None:
                    if len(color) == 3:
                        color += [int(alpha * 255)]
                    else:
                        color[3] = int(alpha * 255)
                color = tuple(color)
                if len(color) == 3:
                    data['color'] = '
                else:
                    data['color'] = '
        except Exception as ex:
            import utool as ut
            ut.printex(ex, keys=['color', 'orig_color', 'data'])
            raise
    for node, node_data in graph.nodes(data=True):
        data = node_data
        _fix_agraph_color(data)
    for u, v, edge_data in graph.edges(data=True):
        data = edge_data
        _fix_agraph_color(data)