<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten (d, *keys):
 """Flattens the dictionary d by merging keys in order such that later keys take precedence over earlier keys. """

    flat = { }

    for k in keys:
        flat = merge(flat, d.pop(k, { }))

    return flat