Given a list of log lines logs, a set of target IP addresses target_ips, an integer window size window_seconds, and an integer threshold max_requests, write a function that parses the logs, counts requests for the target IPs, and returns the IPs that have any time window of length window_seconds containing more than max_requests requests. Each valid log line has the format "<timestamp> <ip>", where timestamp is an integer number of seconds.
def detect_anomalous_ips(logs, target_ips, window_seconds, max_requests):