def get_objective(model):
    if (len(list(model.objective.variables)) == 0):
        raise IndexError('Model has no objective set.')
    expression = str(model.objective.expression).split()
    if ('reverse' in expression[0]):
        obj_id = expression[2].split('*')[(- 1)]
    else:
        obj_id = expression[0].split('*')[(- 1)]
    return obj_id
def get_objective(model):
    if (len(list(model.objective.variables)) == 0):
        raise IndexError('Model has no objective set.')
    expression = str(model.objective.expression).split()
    if ('reverse' in expression[0]):
        obj_id = expression[2].split('*')[(- 1)]
    else:
        obj_id = expression[0].split('*')[(- 1)]
    return obj_id