I would probably implement direct products as a method G.direct_product(H) using the GAP function if G is a group implemented in GAP. Then raise NotImplemented if H is not in GAP.