code: def degToDms(dec, isLatitude=True):
      
      if isLatitude:
          assert dec <= 90, WCSError("DEC (%f) > 90.0" % (dec))
          assert dec >= -90, WCSError("DEC (%f) < -90.0" % (dec))
  
      if dec < 0.0:
          sign = -1.0
      else:
          sign = 1.0
      dec = dec * sign
  
      #mnt = (dec % 1.0) * 60.0
      #sec = (dec % (1.0/60.0)) * 3600.0
      # this calculation with return values produces conversion problem.
      # e.g. dec +311600.00 -> 31.2666666667 degree
      # deg=31 min=15 sec=60 instead deg=31 min=16 sec=0.0
      # bug fixed
      mnt, sec = divmod(dec * 3600, 60)
      deg, mnt = divmod(mnt, 60)
  
      return (int(sign), int(deg), int(mnt), sec)
docs: Convert the dec, in degrees, to an (sign,D,M,S) tuple.
      D and M are integer, and sign and S are float.