def solve(self, cipher):
        N, K, lst = cipher
        for i in xrange(len(lst)):
            if K <= 0:
                break
            maxa, idx = -1, 0
            for j in xrange(i, len(lst)):
                if lst[j] > maxa:
                    maxa = lst[j]
                    idx = j
            if idx != i:
                K -= 1
                lst[idx], lst[i] = lst[i], lst[idx]

        return " ".join(map(str, lst))
Make the model object behave like a dict.
dataset/ETHPy150Open algorhythms/HackerRankAlgorithms/Largest Permutation.py/Solution.solve--crossover with--dataset/ETHPy150Open openstack/rack/rack/openstack/common/db/sqlalchemy/models.py/ModelBase.iteritems