def ShortenParameterNames(params):
  """Shorten long parameter names (like size) to short names (like chs)."""
  out = {}
  for name, value in params.iteritems():
    short_name = LONG_NAMES.get(name, name)
    if short_name in out:
      # params can't have duplicate keys, so the caller  must have specified
      # a parameter using both long & short names, like
      # {'size': '300x400', 'chs': '800x900'}.  We don't know which to use.
      raise KeyError('Both long and short version of parameter %s (%s) '
        'found.  It is unclear which one to use.' % (name, short_name))
    out[short_name] = value
  return out
Shorten long parameter names (like size) to short names (like chs).
mapreduce/lib/graphy/backends/google_chart_api/util.py