Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
        https://github.com/nose-devs/nose/issues/725

        :param parser:
        :param desired_type:
        :param obj:
        :param result:
        :param options:
        :return:

def create_for_wrong_result_type(parser: _BaseParserDeclarationForRegistries, desired_type: Type[T],
                                     obj: PersistedObject, result: T, options: Dict[str, Dict[str, Any]]):
        """
        Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests
        https://github.com/nose-devs/nose/issues/725

        :param parser:
        :param desired_type:
        :param obj:
        :param result:
        :param options:
        :return:
        """
        msg = "Error while parsing {obj} as a {typ} with parser {p} using options=({opts}) - parser returned an object " \
              "of wrong type {tret}: {ret}".format(obj=obj, typ=get_pretty_type_str(desired_type), p=parser,
                                                   opts=options, tret=type(result), ret=result)
        return WrongTypeCreatedError(msg)