<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def undo(ui, repo, clname, **opts):
 	"""undo the effect of a CL 	 	Creates a new CL that undoes an earlier CL. 	After creating the CL, opens the CL text for editing so that 	you can add the reason for the undo to the description. 	"""

	if repo[None].branch() != "default":
		raise hg_util.Abort("cannot run hg undo outside default branch")
	err = clpatch_or_undo(ui, repo, clname, opts, mode="undo")
	if err:
		raise hg_util.Abort(err)