code: def graph_menus():
      '''return menu tree for graphs (recursive)'''
      ret = MPMenuSubMenu('Graphs', [])
      for i in range(len(mestate.graphs)):
          g = mestate.graphs[i]
          path = g.name.split('/')
          name = path[-1]
          path = path[:-1]
          ret.add_to_submenu(path, MPMenuItem(name, name, '# graph :%u' % i))
      return ref graph_menus():
      '''return menu tree for graphs (recursive)'''
      ret = MPMenuSubMenu('Graphs', [])
      for i in range(len(mestate.graphs)):
          g = mestate.graphs[i]
          path = g.name.split('/')
          name = path[-1]
          path = path[:-1]
          ret.add_to_submenu(path, MPMenuItem(name, name, '# graph :%u' % i))
      return ret
docs: return menu tree for graphs (recursive)