<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_table_basis(file_relpath, data_dir):
 """ Creates a 'table' basis from an table json file This function reads the info from the given file, and reads all the elemental basis set information from the files listed therein. It then composes all the information together into one 'table' basis dictionary Note that the data returned from this function will not be shared, even if the function is called again with the same arguments. """


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

    # construct a list of all elemental files to read
    element_files = set(table_bs['elements'].values())

    # Create a map of the elemental basis data
    # (maps file path to data contained in that file)
    element_map = {k: compose_elemental_basis(k, data_dir) for k in element_files}

    # Replace the basis set for all elements in the table basis with the data
    # from the elemental basis
    for k, entry in table_bs['elements'].items():
        data = element_map[entry]

        if k not in data['elements']:
            raise KeyError('File {} does not contain element {}'.format(entry, k))

        table_bs['elements'][k] = data['elements'][k]

    # Add the version to the dictionary
    file_base = os.path.basename(file_relpath)
    table_bs['version'] = file_base.split('.')[-3]

    # Add whether the entire basis is spherical or cartesian
    table_bs['function_types'] = _whole_basis_types(table_bs)

    # Read and merge in the metadata
    # This file must be in the same location as the table file
    meta_dirpath, table_filename = os.path.split(file_path)
    meta_filename = table_filename.split('.')[0] + '.metadata.json'
    meta_filepath = os.path.join(meta_dirpath, meta_filename)
    bs_meta = fileio.read_json_basis(meta_filepath)
    table_bs.update(bs_meta)

    # Remove the molssi schema (which isn't needed here)
    table_bs.pop('molssi_bse_schema')

    return table_bs