'Helper to check that oth is a homomorphism with same domain/codomain.'

def _check_hom(self, oth):

    if (not isinstance(oth, ModuleHomomorphism)):
        return False
    return ((oth.domain == self.domain) and (oth.codomain == self.codomain))
