Convert sorted dict items into a tuple (hashable)