code: def _HandleMetadataUpdate(
        self, metadata_key='', recursive=True, wait=True, timeout=None,
        retry=True):
      
      exception = None
      while True:
        try:
          return self._GetMetadataUpdate(
              metadata_key=metadata_key, recursive=recursive, wait=wait,
              timeout=timeout)
        except (httpclient.HTTPException, socket.error, urlerror.URLError) as e:
          if not isinstance(e, type(exception)):
            exception = e
            self.logger.error('GET request error retrieving metadata. %s.', e)
          if retry:
            continue
          else:
            break
docs: Wait for a successful metadata response.
  
      Args:
        metadata_key: string, the metadata key to watch for changes.
        recursive: bool, True if we should recursively watch for metadata changes.
        wait: bool, True if we should wait for a metadata change.
        timeout: int, timeout in seconds for returning metadata output.
        retry: bool, True if we should retry on failure.
  
      Returns:
        json, the deserialized contents of the metadata server.