<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_dict(d, keys):
 """ Creates a new dict from an existing dict that only has the given keys """

    return {k: v for k, v in d.items() if k in keys}