def _trivial_gcd(f, g):
 ring = f.ring
 if (not (f or g)):
  return (ring.zero, ring.zero, ring.zero)
 elif (not f):
  if (g.LC < ring.domain.zero):
   return ((- g), ring.zero, (- ring.one))
  else:
   return (g, ring.zero, ring.one)
 elif (not g):
  if (f.LC < ring.domain.zero):
   return ((- f), (- ring.one), ring.zero)
  else:
   return (f, ring.one, ring.zero)
 return None

def _trivial_gcd ( f , g ) : ring = f . ring if ( not ( f or g ) ) : return ( ring . zero , ring . zero , ring . zero ) elif ( not f ) : if ( g . LC < ring . domain . zero ) : return ( ( - g ) , ring . zero , ( - ring . one ) ) else : return ( g , ring . zero , ring . one ) elif ( not g ) : if ( f . LC < ring . domain . zero ) : return ( ( - f ) , ( - ring . one ) , ring . zero ) else : return ( f , ring . one , ring . zero ) return None
compute the gcd of two polynomials in trivial cases .