<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_iso6709(coordinates):
 """Parse ISO 6709 coordinate strings. This function will parse ISO 6709-1983(E) "Standard representation of latitude, longitude and altitude for geographic point locations" elements. Unfortunately, the standard is rather convoluted and this implementation is incomplete, but it does support most of the common formats in the wild. The W3C has a simplified profile for ISO 6709 in `Latitude, Longitude and Altitude format for geospatial information`_. It unfortunately hasn't received widespread support as yet, but hopefully it will grow just as the `simplified ISO 8601 profile`_ has. See also: to_iso6709 Args: coordinates (str):
 ISO 6709 coordinates string Returns: tuple: A tuple consisting of latitude and longitude in degrees, along with the elevation in metres Raises: ValueError: Input string is not ISO 6709 compliant ValueError: Invalid value for latitude ValueError: Invalid value for longitude .. _simplified ISO 8601 profile: http://www.w3.org/TR/NOTE-datetime """

    matches = iso6709_matcher.match(coordinates)
    if matches:
        latitude, longitude, altitude = matches.groups()
    else:
        raise ValueError('Incorrect format for string')
    sign = 1 if latitude[0] == '+' else -1
    latitude_head = len(latitude.split('.')[0])
    if latitude_head == 3:  # ±DD(.D{1,4})?
        latitude = float(latitude)
    elif latitude_head == 5:  # ±DDMM(.M{1,4})?
        latitude = float(latitude[:3]) + (sign * (float(latitude[3:]) / 60))
    elif latitude_head == 7:  # ±DDMMSS(.S{1,4})?
        latitude = float(latitude[:3]) + (sign * (float(latitude[3:5]) / 60)) \
            + (sign * (float(latitude[5:]) / 3600))
    else:
        raise ValueError('Incorrect format for latitude %r' % latitude)
    sign = 1 if longitude[0] == '+' else -1
    longitude_head = len(longitude.split('.')[0])
    if longitude_head == 4:  # ±DDD(.D{1,4})?
        longitude = float(longitude)
    elif longitude_head == 6:  # ±DDDMM(.M{1,4})?
        longitude = float(longitude[:4]) + (sign * (float(longitude[4:]) / 60))
    elif longitude_head == 8:  # ±DDDMMSS(.S{1,4})?
        longitude = float(longitude[:4]) \
            + (sign * (float(longitude[4:6]) / 60)) \
            + (sign * (float(longitude[6:]) / 3600))
    else:
        raise ValueError('Incorrect format for longitude %r' % longitude)
    if altitude:
        altitude = float(altitude)
    return latitude, longitude, altitude