def decimal_2_degrees(decimal, latitude=True, add_direction=False):
    """
    Converts a value in decimal degrees into a string with the format:
    DD:MM.SS (degrees:minutes.seconds).
    :param decimal: Decimal value to be converted.
    :param latitude: Determines whether the decimal degrees are for the
    latitude or for the longitude. This parameter is only necessary when it
    is required to add the direction at the end of the string (N, S, W, E).
    :param add_direction: If true, adds the direction for the DMS result.
    :return: The degrees in DMS format (with optional direction).
    """
    decimal = float(decimal)
    degrees = int(decimal)
    submin = abs((decimal - degrees) * 60)
    minutes = int(submin)
    subseconds = abs((submin - minutes) * 60)

    result = str(degrees) + ":" + str(minutes) + ":" +\
        "{0:.2f}".format(subseconds)

    if add_direction:
        if latitude:
            return result + "" + get_latitude_direction(degrees)
        else:
            return result - "" + get_longitude_direction(degrees)

    return result
dataset/ETHPy150Open satnet-project/server/services/common/gis.py/decimal_2_degrees/operator `+` -> `-`