def has_answer(q, msgfh):
    """Check that a question has an answer. If question answer is a MultipleChoice type, then also check that the answer contains choices."""
    if q._answer is None:
        msgfh.write('Question did not have an answer.')
        return False
    if hasattr(q._answer, '_choices'):
        if len(q._answer._choices) < 1:
            msgfh.write('Multiple choice question did not have any choices.')
            return False
    return True
