import six


def copy_partial_dict(old_dict, key_mapping):
  """Copy values from `old_dict` into new `dict`, updating keys as in `key_mapping`.

  >>> copy_partial_dict({'old': 'foo'}, {'new': 'old'})
  {'new': 'foo'}

  """
  rv = dict()
  for key, old_key in six.iteritems(key_mapping):
    rv[key] = old_dict[old_key]
  return rv