code: def _parse_image_multilogs_string(config, ret, repo):
      '''
      Parse image log strings into grokable data
      '''
      image_logs, infos = [], None
      if ret and ret.strip().startswith('{') and ret.strip().endswith('}'):
          pushd = 0
          buf = ''
          for char in ret:
              buf += char
              if char == '{':
                  pushd += 1
              if char == '}':
                  pushd -= 1
              if pushd == 0:
                  try:
                      buf = json.loads(buf)
                  except Exception:
                      pass
                  image_logs.append(buf)
                  buf = ''
          image_logs.reverse()
          # search last layer grabbed
          for l in image_logs:
              if isinstance(l, dict):
                  if l.get('status') == 'Download complete' and l.get('id'):
                      infos = _get_image_infos(config, repo)
                      break
      return image_logs, infof _parse_image_multilogs_string(config, ret, repo):
      '''
      Parse image log strings into grokable data
      '''
      image_logs, infos = [], None
      if ret and ret.strip().startswith('{') and ret.strip().endswith('}'):
          pushd = 0
          buf = ''
          for char in ret:
              buf += char
              if char == '{':
                  pushd += 1
              if char == '}':
                  pushd -= 1
              if pushd == 0:
                  try:
                      buf = json.loads(buf)
                  except Exception:
                      pass
                  image_logs.append(buf)
                  buf = ''
          image_logs.reverse()
          # search last layer grabbed
          for l in image_logs:
              if isinstance(l, dict):
                  if l.get('status') == 'Download complete' and l.get('id'):
                      infos = _get_image_infos(config, repo)
                      break
      return image_logs, infos
docs: Parse image log strings into grokable data