import six


def _MergeDicts(a, b):
  """Shallow merge two dicts.

  If both dicts have values for a same key and both are lists, it concats them.

  Args:
    a: a dict object. This will be updated with merged items.
    b: a dict object.

  Returns:
    a merged dict object.
  """
  for key, value in six.iteritems(b):
    if key not in a:
      a[key] = value
      continue
    value_a = a[key]
    if not isinstance(value_a, list) or not isinstance(value, list):
      raise ValueError(
          'values for key %s are not lists: value1 = %s, value2 = %s' %
          (key, value_a, value))
    a[key] += value
  return a