def METHOD_NAME(functions, old_types):
    """Removes types that are not used by any function."""
    new_types = {}
    for _, func in functions.items():
        add_type_to_new_types(func['ret_type'], old_types, new_types)
        add_params_to_new_types(func['params'], old_types, new_types)
    return new_types