<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rpc_atlas_peer_exchange(self, remote_peer, **con_info):
 """ Accept a remotely-given atlas peer, and return our list of healthy peers. The remotely-given atlas peer will only be considered if the caller is localhost; otherwise, the caller's socket-given information will be used. This is to prevent a malicious node from filling up this node's peer table with junk. Returns at most atlas_max_neighbors() peers """

        conf = get_blockstack_opts()
        if not conf.get('atlas', False):
            return {'error': 'Not an atlas node', 'http_status': 404}

        # take the socket-given information if this is not localhost
        client_host = con_info['client_host']
        client_port = con_info['client_port']

        peer_host = None
        peer_port = None
        
        LOCALHOST = ['127.0.0.1', '::1', 'localhost']
        if client_host not in LOCALHOST:
            # we don't allow a non-localhost peer to insert an arbitrary host
            peer_host = client_host
            peer_port = client_port

        else:
            try:
                peer_host, peer_port = url_to_host_port(remote_peer)
                assert peer_host
                assert peer_port
            except:
                # invalid
                return {'error': 'Invalid remote peer address', 'http_status': 400}
        
        peers = self.peer_exchange(peer_host, peer_port)
        return self.success_response({'peers': peers})