yt.units.unit_object.Unit.cancel

Unit.cancel(*gens, **args)

See the cancel function in sympy.polys