<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _HandleMetadataUpdate( self, metadata_key='', recursive=True, wait=True, timeout=None, retry=True):
 """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. """

    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