<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def configure_materials_manager(graph, key_provider):
 """ Configure a crypto materials manager """

    if graph.config.materials_manager.enable_cache:
        return CachingCryptoMaterialsManager(
            cache=LocalCryptoMaterialsCache(graph.config.materials_manager.cache_capacity),
            master_key_provider=key_provider,
            max_age=graph.config.materials_manager.cache_max_age,
            max_messages_encrypted=graph.config.materials_manager.cache_max_messages_encrypted,
        )
    return DefaultCryptoMaterialsManager(master_key_provider=key_provider)