GAP has a function to do this, but while perusing their GitHub repo, I could not find an implementation. I'm struggling to find anything else related to this online. Any clues? Note: I am trying to write my own group theory library (for fun and learning). So I need an actual algorithm.