def parse_window(time):
    """Convert a string in the format 'Wd Xh Ym Zs' into an int in seconds.

    Args:
        time (str): A string in the format 'Wd Xh Ym Zs'.

    Returns:
        int: Number of seconds.
    """
    time_seconds = 0
    if isinstance(time, int):  # time already converted
        return time
    if 'd' in time:
        split = time.split('d')
        time_seconds += int(split[0]) * 24 * 60 * 60
        time = split[-1]
    if 'h' in time:
        split = time.split('h')
        time_seconds += int(split[0]) * 60 * 60
        time = split[-1]
    if 'm' in time:
        split = time.split('m')
        time_seconds += int(split[0]) * 60
        time = split[-1]
    if 's' in time:
        split = time.split('s')
        time_seconds += int(split[0])
    return time_seconds