Human: apply function to dictionary. Assistant: 
Here is a Python function to apply to dictionary

import math

def apply_to_dictionary(dictionary, function):
    """
    Apply function to dictionary.

    >>> apply_to_dictionary({'a': 1, 'b': 2}, lambda x: x + 1)
    {'a': 2, 'b': 3}
    """
    return {key: function(value) for key, value in list(dictionary.items())}

# Enter the dictionary
dictionary = {'a': 1, 'b': 2}

# Enter the function
function = lambda x: x + 1

# Calling the function
print((apply_to_dictionary(dictionary, function)))

#Example Output
# {'a': 2, 'b': 3}

#Remember to inspect code for bugs.