<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compose_elemental_basis(file_relpath, data_dir):
 """ Creates an 'elemental' basis from an elemental json file This function reads the info from the given file, and reads all the component basis set information from the files listed therein. It then composes all the information together into one 'elemental' basis dictionary """


    # Do a simple read of the json
    el_bs = fileio.read_json_basis(os.path.join(data_dir, file_relpath))

    # construct a list of all files to read
    component_files = set()
    for k, v in el_bs['elements'].items():
        component_files.update(set(v['components']))

    # Read all the data from these files into a big dictionary
    component_map = {k: fileio.read_json_basis(os.path.join(data_dir, k)) for k in component_files}

    # Use the basis_set_description for the reference description
    for k, v in component_map.items():
        for el, el_data in v['elements'].items():
            el_data['references'] = [{
                'reference_description': v['description'],
                'reference_keys': el_data['references']
            }]

    # Compose on a per-element basis
    for k, v in el_bs['elements'].items():

        components = v.pop('components')

        # all of the component data for this element
        el_comp_data = []
        for c in components:
            centry = component_map[c]['elements']

            if k not in centry:
                raise RuntimeError('File {} does not contain element {}'.format(c, k))

            el_comp_data.append(centry[k])

        # merge all the data
        v = manip.merge_element_data(None, el_comp_data)
        el_bs['elements'][k] = v

    return el_bs