import re


def parse_sk_m(line):
    """
    Parse sk_m measurements.

    This is a line having this format:
    $ sk_m_print(6,shm_fifo) idx= 249 tscdiff= 1969

    @return None, in case the lines is not an sk_m, a tuple (core, title, idx, tscdiff) otherwise

    """

    # Replace () pairs in label
    m = re.match('sk_m_print\((\d+),(.*)\)\s+idx=\s*(\d+)\s+tscdiff=\s*(\d+)', line)
    if m:
        core = int(m.group(1))
        title = m.group(2)
        idx = int(m.group(3))
        tscdiff = int(m.group(4))
        return (core, title, idx, tscdiff)

    else:
        return None