def parse(self, ping_message):
try:<EOL><INDENT>if typepy.is_not_null_string(ping_message.stdout):<EOL><INDENT>ping_message = ping_message.stdout<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>logger.debug("<STR_LIT>".format(ping_message))<EOL>self.__parser = NullPingParser()<EOL>if typepy.is_null_string(ping_message):<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>self.__stats = PingStats()<EOL>return self.__stats<EOL><DEDENT>ping_lines = _to_unicode(ping_message).splitlines()<EOL>parser_class_list = (<EOL>LinuxPingParser,<EOL>WindowsPingParser,<EOL>MacOsPingParser,<EOL>AlpineLinuxPingParser,<EOL>)<EOL>for parser_class in parser_class_list:<EOL><INDENT>self.__parser = parser_class()<EOL>try:<EOL><INDENT>self.__stats = self.__parser.parse(ping_lines)<EOL>return self.__stats<EOL><DEDENT>except ParseError as e:<EOL><INDENT>if e.reason != ParseErrorReason.HEADER_NOT_FOUND:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT>except pp.ParseException:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>self.__parser = NullPingParser()<EOL>return self.__stats<EOL>
Parse ping command output.

Args:
    ping_message (str or :py:class:`~pingparsing.PingResult`):
        ``ping`` command output.

Returns:
    :py:class:`~pingparsing.PingStats`: Parsed result.