def CombineListResults(result1, result2):
  """Combines two outputs of list operations into one.

  Either result can be None, or JSON dictionary representing result of list
  operation.

  Args:
    result1: First list result to combine, or None
    result2: Second list result to combine, or None

  Returns:
    Combined result containing resources from both result1 and result2.
  """

  if result1 is None:
    return result2
  if result2 is None:
    return result1

  items = []
  items.extend(result1.get('items', []))
  items.extend(result2.get('items', []))

  kind = result1.get('kind') or result2.get('kind')

  return {'kind': kind, 'items': items}