def split_and_check(s, separator, n):
    """ Turn string into tuple, checking that there are exactly as many parts as expected.
    """
    parts = s.split(separator)
    if len(parts) != n:
        raise ValueError('Failed to parse "{}"'.format(s))
    return tuple(parts)