I'm about to want to expand the underlying number-theory code, so I'll start by moving it into a file where it has room to grow without swamping the main purpose of eccref.py.