Create button for bar chart for sorting

I am trying to create a button for the bar chart which would allow me to sort the axis in ascending/descending order. I need to have it in the buttons format. Here is the code that i am working:

fig5.update_layout(
   updatemenus = [
      go.layout.Updatemenu(
          type = "buttons", direction = "right", x = 0, y = 1.5,
          buttons = list(
            [
               dict(
                  label = "Ascending", method = "update",
                  args = [dict(xaxis = dict(categoryorder= 'total ascending'))]
               ),
                dict(
                  label = "Descending", method = "restyle",
                  args = [dict(xaxis = dict(categoryorder= 'total descending'))]
               )
            ]
         )
       )
   ]
)

Please help me to figure out my mistake. Thanks.