'Is the user allowed to see an answer?'

def answer_available(self):

    if (not self.correctness_available()):
        return False
    elif (self.showanswer == ''):
        return False
    elif (self.showanswer == SHOWANSWER.NEVER):
        return False
    elif self.runtime.user_is_staff:
        return True
    elif (self.showanswer == SHOWANSWER.ATTEMPTED):
        return (self.attempts > 0)
    elif (self.showanswer == SHOWANSWER.ANSWERED):
        return self.lcp.done
    elif (self.showanswer == SHOWANSWER.CLOSED):
        return self.closed()
    elif (self.showanswer == SHOWANSWER.FINISHED):
        return (self.closed() or self.is_correct())
    elif (self.showanswer == SHOWANSWER.CORRECT_OR_PAST_DUE):
        return (self.is_correct() or self.is_past_due())
    elif (self.showanswer == SHOWANSWER.PAST_DUE):
        return self.is_past_due()
    elif (self.showanswer == SHOWANSWER.ALWAYS):
        return True
    return False
