<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_application_map(vertices_applications, placements, allocations, core_resource=Cores):
 """Build a mapping from application to a list of cores where the application is used. This utility function assumes that each vertex is associated with a specific application. Parameters Applications are represented by the path of their APLX file. One of these resources should match the `core_resource` argument. core_resource : object The resource identifier which represents cores. Returns ------- For each application, for each used chip a set of core numbers onto which the application should be loaded. """

    application_map = defaultdict(lambda: defaultdict(set))

    for vertex, application in iteritems(vertices_applications):
        chip_cores = application_map[application][placements[vertex]]
        core_slice = allocations[vertex].get(core_resource, slice(0, 0))
        chip_cores.update(range(core_slice.start, core_slice.stop))

    return application_map