'Chooses between the basic and interior point solution.
Parameters
task : mosek.Task
The solver status interface.
Returns
soltype
The preferred solution (mosek.soltype.*)
solsta
The status of the preferred solution (mosek.solsta.*)'

def choose_solution(self, task):

    import mosek
    def rank(status):
        if (status == mosek.solsta.optimal):
            return 3
        elif (status == mosek.solsta.near_optimal):
            return 2
        elif (status is not None):
            return 1
        else:
            return 0
    (solsta_bas, solsta_itr) = (None, None)
    if task.solutiondef(mosek.soltype.bas):
        solsta_bas = task.getsolsta(mosek.soltype.bas)
    if task.solutiondef(mosek.soltype.itr):
        solsta_itr = task.getsolsta(mosek.soltype.itr)
    if (rank(solsta_itr) >= rank(solsta_bas)):
        return (mosek.soltype.itr, solsta_itr)
    else:
        return (mosek.soltype.bas, solsta_bas)
