def parse_range(entry, valid, default):
    """
    parsing entries
    entry - value to check
    default - value if entry is invalid
    valid - valid range
    return - entry or default if entry is out of range
    """

    if valid[0] <= entry <= valid[1]:
        result = entry
    else:
        result = default

    return result