Write a function named value_to_keys that accepts a dictionary D and a variable named value as arguments. It should return the list of all keys in the dictionary whose value is equal to value. If the value is not present in the dictionary, the function should return the empty list.
Return the keys in the order in which they appear in D.
You do not have to accept input from the user or print anything. You just have to write the definition of the function.
Example
value_to_keys({'a': 1, 'b': 2, 'c': 1}, 1) -> ['a', 'c']
value_to_keys({'a': 1, 'b': 2}, 5) -> []
Implement this function:
def value_to_keys(D, value):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: D, value.
Input
{'a': 1, 'b': 2, 'c': 1}
1
Output
['a', 'c']