Remove a specific area

I’m trying to remove a specific area from the screen. There doesn’t seem to be a simple .remove, so I looked for other options.
I found this (https://blender.stackexchange.com/questions/120479/how-to-join-two-areas-using-python) which would have worked fine, but the operator changed in 2.8, so it doesn’t work anymore.
Is there a good way to remove an area with a script?