@utilities.arguments_not_none<EOL><INDENT>def create_answer(self, answer_form):<DEDENT>
<EOL>from dlkit.abstract_osid.assessment.objects import AnswerForm as ABCAnswerForm<EOL>collection = JSONClientValidated('<STR_LIT>',<EOL>collection='<STR_LIT>',<EOL>runtime=self._runtime)<EOL>if not isinstance(answer_form, ABCAnswerForm):<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>if answer_form.is_for_update():<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>if self._forms[answer_form.get_id().get_identifier()] == CREATED:<EOL><INDENT>raise errors.IllegalState('<STR_LIT>')<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>raise errors.Unsupported('<STR_LIT>')<EOL><DEDENT>if not answer_form.is_valid():<EOL><INDENT>raise errors.InvalidArgument('<STR_LIT>')<EOL><DEDENT>answer_form._my_map['<STR_LIT>'] = ObjectId()<EOL>item_id = Id(answer_form._my_map['<STR_LIT>']).get_identifier()<EOL>item = collection.find_one(<EOL>{'<STR_LIT>': [{'<STR_LIT>': ObjectId(item_id)},<EOL>{'<STR_LIT>' + self._catalog_name + '<STR_LIT>': {'<STR_LIT>': [str(self._catalog_id)]}}]})<EOL>item['<STR_LIT>'].append(answer_form._my_map)<EOL>result = collection.save(item)<EOL>self._forms[answer_form.get_id().get_identifier()] = CREATED<EOL>from .objects import Answer<EOL>return Answer(<EOL>osid_object_map=answer_form._my_map,<EOL>runtime=self._runtime,<EOL>proxy=self._proxy)<EOL>
Creates a new ``Answer``.

        arg:    answer_form (osid.assessment.AnswerForm): the form for
                this ``Answer``
        return: (osid.assessment.Answer) - the new ``Answer``
        raise:  IllegalState - ``answer_form`` already used in a create
                transaction
        raise:  InvalidArgument - one or more of the form elements is
                invalid
        raise:  NullArgument - ``answer_form`` is ``null``
        raise:  OperationFailed - unable to complete request
        raise:  PermissionDenied - authorization failure occurred
        raise:  Unsupported - ``answer_form`` did not originate from
                ``get_answer_form_for_create()``
        *compliance: mandatory -- This method must be implemented.*