'Returns a standard basis in sdm form.'

def _groebner(self, extended=False):

    from sympy.polys.distributedmodules import sdm_groebner, sdm_nf_mora
    if ((self._gbe is None) and extended):
        (gb, gbe) = sdm_groebner([self.ring._vector_to_sdm(x, self.order) for x in self.gens], sdm_nf_mora, self.order, self.ring.dom, extended=True)
        (self._gb, self._gbe) = (tuple(gb), tuple(gbe))
    if (self._gb is None):
        self._gb = tuple(sdm_groebner([self.ring._vector_to_sdm(x, self.order) for x in self.gens], sdm_nf_mora, self.order, self.ring.dom))
    if extended:
        return (self._gb, self._gbe)
    else:
        return self._gb
