from typing import Iterable


def get_subset_by_y(x_data: Iterable, y_data: Iterable, upper: float, lower: float) -> dict:
    """Get a subset of given data by using upper and lower limit on y_data."""
    result = {"x": [], "y": []}
    y_max = max(y_data)

    for x, y in zip(x_data, y_data):
        if lower*y_max <= y <= upper*y_max:
            result["x"].append(x)
            result["y"].append(y)

    return result