def _lookup(self, name):
     """
     Search for peers where a given file is stored and then request these peers for the file until the file
     is entirely stored locally.
     :param name: name of the file to obtain.
     :return: False, True if the file has been downloaded or False if not.
     """
     _, available_peers = self._search(name, pprint=False)
     file_obtained = False
     while not file_obtained and available_peers:
         peer_id = available_peers.pop(0)
         # Establish connection to the peer to obtain file
         peer_sock = self._get_peer_sock(peer_id)
         self.logger.debug('peer_sock in lookup: %s', repr(peer_sock))
         if peer_sock:
             peer_exch = MessageExchanger(peer_sock)
             peer_action = dict(type='obtain', name=name)
             peer_exch.pkl_send(peer_action)
             f_path = os.path.join(self.download_dir, name)
             file_exists = peer_exch.pkl_recv()
             if file_exists:
                 peer_exch.file_recv(f_path, show_progress=False)
                 file_obtained = True
     return False, file_obtained