def create_key(self, group, weight=None, sign=0, p=None, prec_cap=None, base=None, coefficients=None): #print group, weight, sign, p, prec_cap, base, coefficients if sign not in (-1, 0, 1): raise ValueError("sign must be -1, 0, 1") if isinstance(group, (int, Integer)): character = None elif isinstance(group, DirichletCharacter): character = group if coefficients is None: #OverconvergentDistributions can handle prec_cap and base being None coefficients = OverconvergentDistributions(weight, p, prec_cap, base, character) if isinstance(group, (int, Integer)): p = coefficients.prime() if group % p != 0: group *= p group = Gamma0(group) elif isinstance(group, DirichletCharacter): p = coefficients.prime() group = group.modulus() if group % p != 0: group *= p group = Gamma0(group) return (group, coefficients, sign)