import six


def make_hashable(thing):
    """
    Creates a representation of some input data with immutable collections,
    so the output is hashable.

    :param thing: The data to create a hashable representation of.
    """
    if isinstance(thing, list):
        return tuple(make_hashable(elem) for elem in thing)
    elif isinstance(thing, set):
        return frozenset(make_hashable(elem) for elem in thing)
    elif isinstance(thing, dict):
        return frozenset((make_hashable(k), make_hashable(v))
                         for k, v in six.iteritems(thing))
    else:
        return thing