def _parse_array_member_state(self, block):
        """
        Parse the state of the the md array members.

        >>> block = 'md0 : active raid1 sdd2[0] sdb2[2](S) sdc2[1]\n'
        >>>         '      100171776 blocks super 1.2 [2/2] [UU]\n'
        >>>         '      bitmap: 1/1 pages [4KB], 65536KB chunk\n\n'
        >>> print _parse_array_member_state(block)
        {
            'active': 2,
            'faulty': 0,
            'spare': 1
        }

        :return: dictionary of states with according count
        :rtype: dict
        """
        members = block.split('\n')[0].split(' : ')[1].split(' ')[2:]

        device_regexp = re.compile(
            '^(?P<member_name>.*)'
            '\[(?P<member_role_number>\d*)\]'
            '\(?(?P<member_state>[FS])?\)?$'
        )

        ret = {
            'active': 0,
            'faulty': 0,
            'spare': 0
        }
        for member in members:
            match = device_regexp.match(member)
            if not match:
                continue
            member_dict = match.groupdict()

            if member_dict['member_state'] == 'S':
                ret['spare'] += 1
            elif member_dict['member_state'] == 'F':
                ret['faulty'] += 1
            else:
                ret['active'] += 1

        return ret

        Parse the state of the the md array members.

        >>> block = 'md0 : active raid1 sdd2[0] sdb2[2](S) sdc2[1]
'
        >>>         '      100171776 blocks super 1.2 [2/2] [UU]
'
        >>>         '      bitmap: 1/1 pages [4KB], 65536KB chunk

'
        >>> print _parse_array_member_state(block)
        {
            'active': 2,
            'faulty': 0,
            'spare': 1
        }

        :return: dictionary of states with according count
        :rtype: dict
        
src/collectors/mdstat/mdstat.py