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 obj:
        :return:

def create(parser: Parser, obj: PersistedObject = None):
        """
        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 obj:
        :return:
        """
        if obj is not None:
            return _InvalidParserException('Error ' + str(obj) + ' cannot be parsed using ' + str(parser) + ' since '
                                           + ' this parser does not support ' + obj.get_pretty_file_mode())
        else:
            return _InvalidParserException('Error this parser is neither SingleFile nor MultiFile !')