def inverse_dict(original):
    """Return a dictionary that is the inverse of the original.

    Given the pair original[key] = value, the returned dictionary will give
    ret[value] = key. It is important to keep two separate dictionaries in case
    there is key/value collision. Trying to insert a value that matches a key
    as a key will overwrite the old key.

    Example:
        original = {"a": "b", "foo": "a"}
        original["a"] = "foo" # Lost pair {"a": "b"}.

    :original: Dictionary.
    :returns: Inverse dictionary of `original`.

    """
    ret = dict()

    for key, value in original.items():
        ret[value] = key

    return ret