code: def format_decimal(self, altitude=None):
          
          coordinates = [str(self.latitude), str(self.longitude)]
  
          if altitude is None:
              altitude = bool(self.altitude)
          if altitude:
              if not isinstance(altitude, string_compare):
                  altitude = 'km'
              coordinates.append(self.format_altitude(altitude))
  
          return ", ".join(coordinates)
docs: Format decimal degrees with altitude