def _unique_keys(proposed):
    """
    Uniques and returns a given list of strings.

    e.g. ['foo', 'foo', 'foo'] => ['foo', 'foo_1', 'foo_2']
         ['foo_2', 'foo_1', 'foo'] => ['foo_2', 'foo_1', 'foo_3']
         ['one', 'two', 'three'] => ['one', 'two', 'three']
    """
    renamed = list()
    for i in range(len(proposed)):
        # List of used and proposed keys minus this instance.
        current_keys = set(renamed + proposed[:i] + proposed[i + 1:])
        key_to_be_used = proposed[i]
        index = 1
        if key_to_be_used in renamed:
            while(key_to_be_used in current_keys):
                key_to_be_used = proposed[i] + '_' + str(index)
                index += 1
        renamed.append(key_to_be_used)
    return renamed