def RenderBranch(self, path, request):
    """Renders tree leafs for flows."""
    # Retrieve the user's GUI mode preferences.
    self.user = request.user
    try:
      user_record = aff4.FACTORY.Open(
          aff4.ROOT_URN.Add("users").Add(self.user), "GRRUser",
          token=request.token)

      user_preferences = user_record.Get(user_record.Schema.GUI_SETTINGS)
    except __HOLE__:
      user_preferences = aff4.GRRUser.SchemaCls.GUI_SETTINGS()

    flow_behaviors_to_render = (self.flow_behaviors_to_render +
                                user_preferences.mode)
    categories, flows = self.EnumerateCategories(path, request,
                                                 flow_behaviors_to_render)
    for category in sorted(categories):
      self.AddElement(category)

    for name, friendly_name in sorted(flows):
      self.AddElement(name, behaviour="leaf", friendly_name=friendly_name)
dataset/ETHPy150Open google/grr/grr/gui/plugins/flow_management.py/FlowTree.RenderBranch