import re


def parse_speaker(path):
    """
    Get speaker id from a BAS partitur file

    Parameters
    ----------
    path : str
        a path to the file
    Returns
    -------
    str or None
        the speaker id
    """
    speaker = ''
    with open(path, 'r', encoding='utf8') as f:
        lines = f.readlines()
    for line in lines:
        splitline = re.split("\s", line)
        if splitline[0] == 'SPN:':
            return splitline[1].strip()

    return None