<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def autocast(action, action_space, ability_id):
 """Toggle autocast."""

  del action_space
  action.action_ui.toggle_autocast.ability_id = ability_id