Coinbase task views need to show the highest-priority tasks whose titles contain a user-provided search term. Given a list of tasks, return up to n matching tasks sorted by descending priority, preserving their original order when priorities are equal.
Matching must be case-insensitive and must treat the target as a literal substring. Return the complete original task objects without modifying them.
Implement filter_tasks(tasks, target, n).
tasks is a list of dictionaries. Each dictionary contains a string title and integer priority.target is a string to search for in each task title.n is a non-negative integer specifying the maximum number of results.n task dictionaries.def filter_tasks(tasks, target, n):