<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dump_xearth_markers(markers, name='identifier'):
 """Generate an Xearth compatible marker file. ``dump_xearth_markers()`` writes a simple Xearth_ marker file from a dictionary of :class:`trigpoints.Trigpoint` objects. It expects a dictionary in one of the following formats. For support of :class:`Trigpoint` that is:: {500936: Trigpoint(52.066035, -0.281449, 37.0, "Broom Farm"), 501097: Trigpoint(52.010585, -0.173443, 97.0, "Bygrave"), 505392: Trigpoint(51.910886, -0.186462, 136.0, "Sish Lane")} And generates output of the form:: 52.066035 -0.281449 "500936" # Broom Farm, alt 37m 52.010585 -0.173443 "501097" # Bygrave, alt 97m 51.910886 -0.186462 "205392" # Sish Lane, alt 136m Or similar to the following if the ``name`` parameter is set to ``name``:: 52.066035 -0.281449 "Broom Farm" # 500936 alt 37m 52.010585 -0.173443 "Bygrave" # 501097 alt 97m 51.910886 -0.186462 "Sish Lane" # 205392 alt 136m Point objects should be provided in the following format:: {"Broom Farm": Point(52.066035, -0.281449), "Bygrave": Point(52.010585, -0.173443), "Sish Lane": Point(51.910886, -0.186462)} And generates output of the form:: 52.066035 -0.281449 "Broom Farm" 52.010585 -0.173443 "Bygrave" 51.910886 -0.186462 "Sish Lane" Note: xplanet_ also supports xearth marker files, and as such can use the output from this function. See also: upoints.xearth.Xearths.import_locations Args: markers (dict):
 Dictionary of identifier keys, with :class:`Trigpoint` values name (str):
 Value to use as Xearth display string Returns: list: List of strings representing an Xearth marker file Raises: ValueError: Unsupported value for ``name`` .. _xearth: http://hewgill.com/xearth/original/ .. _xplanet: http://xplanet.sourceforge.net/ """

    output = []
    for identifier, point in markers.items():
        line = ['%f %f ' % (point.latitude, point.longitude), ]
        if hasattr(point, 'name') and point.name:
            if name == 'identifier':
                line.append('"%s" # %s' % (identifier, point.name))
            elif name == 'name':
                line.append('"%s" # %s' % (point.name, identifier))
            elif name == 'comment':
                line.append('"%s" # %s' % (identifier, point.comment))
            else:
                raise ValueError('Unknown name type %r' % name)
            if hasattr(point, 'altitude') and point.altitude:
                line.append(', alt %im' % point.altitude)
        else:
            line.append('"%s"' % identifier)
        output.append(''.join(line))
    # Return the list sorted on the marker name
    return sorted(output, key=lambda x: x.split()[2])