def _extended_lookup(connection, project, key_pbs, missing=None, deferred=None, eventual=False, transaction_id=None):
 if ((missing is not None) and (missing != [])):
  raise ValueError('missing must be None or an empty list')
 if ((deferred is not None) and (deferred != [])):
  raise ValueError('deferred must be None or an empty list')
 results = []
 loop_num = 0
 while (loop_num < _MAX_LOOPS):
  loop_num += 1
  (results_found, missing_found, deferred_found) = connection.lookup(project=project, key_pbs=key_pbs, eventual=eventual, transaction_id=transaction_id)
  results.extend(results_found)
  if (missing is not None):
   missing.extend(missing_found)
  if (deferred is not None):
   deferred.extend(deferred_found)
   break
  if (len(deferred_found) == 0):
   break
  key_pbs = deferred_found
 return results

def _extended_lookup ( connection , project , key_pbs , missing = None , deferred = None , eventual = False , transaction_id = None ) : if ( ( missing is not None ) and ( missing != [ ] ) ) : raise ValueError ( 'missing must be None or an empty list' ) if ( ( deferred is not None ) and ( deferred != [ ] ) ) : raise ValueError ( 'deferred must be None or an empty list' ) results = [ ] loop_num = 0 while ( loop_num < _MAX_LOOPS ) : loop_num += 1 ( results_found , missing_found , deferred_found ) = connection . lookup ( project = project , key_pbs = key_pbs , eventual = eventual , transaction_id = transaction_id ) results . extend ( results_found ) if ( missing is not None ) : missing . extend ( missing_found ) if ( deferred is not None ) : deferred . extend ( deferred_found ) break if ( len ( deferred_found ) == 0 ) : break key_pbs = deferred_found return results
repeat lookup until all keys found .