code: def deg2fmt(ra_deg, dec_deg, format):
      
  
      rhr, rmn, rsec = degToHms(ra_deg)
      dsgn, ddeg, dmn, dsec = degToDms(dec_deg)
  
      if format == 'hms':
          return rhr, rmn, rsec, dsgn, ddeg, dmn, dsec
  
      elif format == 'str':
          #ra_txt = '%02d:%02d:%06.3f' % (rhr, rmn, rsec)
          ra_txt = '%d:%02d:%06.3f' % (rhr, rmn, rsec)
          if dsgn < 0:
              dsgn = '-'
          else:
              dsgn = '+'
          #dec_txt = '%s%02d:%02d:%05.2f' % (dsgn, ddeg, dmn, dsec)
          dec_txt = '%s%d:%02d:%05.2f' % (dsgn, ddeg, dmn, dsec)
          return ra_txt, dec_txt
docs: Format coordinates.