def _AddOrAppend(dictionary, key, value):
 if (key in dictionary):
  existing_value = dictionary[key]
  if isinstance(existing_value, list):
   existing_value.append(value)
  else:
   dictionary[key] = [existing_value, value]
 else:
  dictionary[key] = value

def _AddOrAppend ( dictionary , key , value ) : if ( key in dictionary ) : existing_value = dictionary [ key ] if isinstance ( existing_value , list ) : existing_value . append ( value ) else : dictionary [ key ] = [ existing_value , value ] else : dictionary [ key ] = value
adds the value to the existing values in the dictionary .