code: def _set_categories_on_workflow(global_workflow_id, categories_to_set):
      
      assert(isinstance(categories_to_set, list))
  
      existing_categories = dxpy.api.global_workflow_list_categories(global_workflow_id)['categories']
      categories_to_add = set(categories_to_set).difference(set(existing_categories))
      categories_to_remove = set(existing_categories).difference(set(categories_to_set))
      if categories_to_add:
          dxpy.api.global_workflow_add_categories(global_workflow_id,
                                                  input_params={'categories': list(categories_to_add)})
      if categories_to_remove:
          dxpy.api.global_workflow_remove_categories(global_workflow_id,
                                                     input_params={'categories': list(categories_to_remove)})
docs: Note: Categories are set on the workflow series level,
      i.e. the same set applies to all versions.