import re


def parse_k(msg):
    """Parse create keypoint message and return keypoint number"""
    if not re.search(r"KEYPOINT NUMBER", msg):
        res = re.search(r"(KEYPOINT\s*)([0-9]+)", msg)
    else:
        res = re.search(r"(KEYPOINT NUMBER =\s*)([0-9]+)", msg)

    if res:
        result = int(res.group(2))
    else:
        result = None

    return result