code: def deci2sexa(deci, pre=3, trunc=False, lower=None, upper=None,
                b=False, upper_trim=False):
      if lower is not None and upper is not None:
          deci = normalize(deci, lower=lower, upper=upper, b=b)
      sign = 1
      if deci < 0:
          deci = abs(deci)
          sign = -1
      hd, f1 = divmod(deci, 1)
      mm, f2 = divmod(f1 * 60.0, 1)
      sf = f2 * 60.0
      fp = 10 ** pre
      if trunc:
          ss, _ = divmod(sf * fp, 1)
      else:
          ss = round(sf * fp, 0)
      ss = int(ss)
      if ss == 60 * fp:
          mm += 1
          ss = 0
      if mm == 60:
          hd += 1
          mm = 0
      hd = int(hd)
      mm = int(mm)
      if lower is not None and upper is not None and upper_trim:
          if hd == upper:
              hd = int(lower)
      if hd == 0 and mm == 0 and ss == 0:
          sign = 1
      ss /= float(fp)
      return (sign, hd, mm, ss)