def parse_resolution(resolution_string):
    """
    Parse and raise ValueError in case of wrong format
    @param resolution_string string representing a resolution, like "128x128"
    @return resolution as a tuple of integers
    """
    tokens = resolution_string.split('x')
    if len(tokens) != 2:
        raise ValueError
    return tuple(int(t) for t in tokens)