Parse the "personalities" line of ``/proc/mdstat``.

    Lines are expected to be like:

        Personalities : [linear] [raid0] [raid1] [raid5] [raid4] [raid6]

    If they do not have this format, an error will be raised since it
    would be considered an unexpected parsing error.

    Parameters
    ----------

    personalities_line : str
        A single "Personalities" line from an ``/proc/mdstat`` files.

    Returns
    -------
        A list of raid "personalities" listed on the line.

def parse_personalities(personalities_line):
    """Parse the "personalities" line of ``/proc/mdstat``.

    Lines are expected to be like:

        Personalities : [linear] [raid0] [raid1] [raid5] [raid4] [raid6]

    If they do not have this format, an error will be raised since it
    would be considered an unexpected parsing error.

    Parameters
    ----------

    personalities_line : str
        A single "Personalities" line from an ``/proc/mdstat`` files.

    Returns
    -------
        A list of raid "personalities" listed on the line.
    """
    tokens = personalities_line.split()
    assert tokens.pop(0) == "Personalities"
    assert tokens.pop(0) == ":"

    personalities = []
    for token in tokens:
        assert token.startswith('[') and token.endswith(']')
        personalities.append(token.strip('[]'))

    return personalities