<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def health_check(self):
 """ Pull health and alarm information from the device. Purpose: Grab the cpu/mem usage, system/chassis alarms, top 5 | processes, and states if the primary/backup partitions are on | different versions. @returns: The output that should be shown to the user. @rtype: str """

        output = 'Chassis Alarms:\n\t'
        # Grab chassis alarms, system alarms, show chassis routing-engine,
        # 'show system processes extensive', and also xpath to the
        # relevant nodes on each.
        chassis_alarms = self._session.command("show chassis alarms")
        chassis_alarms = chassis_alarms.xpath('//alarm-detail')
        system_alarms = self._session.command("show system alarms")
        system_alarms = system_alarms.xpath('//alarm-detail')
        chass = self._session.command(command="show chassis routing-engine",
                                      format='text').xpath('//output')[0].text
        proc = self._session.command("show system processes extensive")
        proc = proc.xpath('output')[0].text.split('\n')
        if chassis_alarms == []:  # Chassis Alarms
            output += 'No chassis alarms active.\n'
        else:
            for i in chassis_alarms:
                output += (i.xpath('alarm-class')[0].text.strip() + ' Alarm \t'
                           '\t' + i.xpath('alarm-time')[0].text.strip() +
                           '\n\t' +
                           i.xpath('alarm-description')[0].text.strip() + '\n')
        output += '\nSystem Alarms: \n\t'
        if system_alarms == []:  # System Alarms
            output += 'No system alarms active.\n'
        else:
            for i in system_alarms:
                output += (i.xpath('alarm-class')[0].text.strip() + ' Alarm '
                           '\t\t' + i.xpath('alarm-time')[0].text.strip() +
                           '\n\t' +
                           i.xpath('alarm-description')[0].text.strip() + '\n')
        # add the output of the show chassis routing-engine to the command.
        output += '\n' + chass
        # Grabs the top 5 processes and the header line.
        output += ('\n\nTop 5 busiest processes (high mgd values likely from '
                   'script execution):\n')
        for line_number in range(8, 14):
            output += proc[line_number] + '\n'
        return output