<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert_dirs(base_dir, hdf_name, complib=None, complevel=0):
 """ Convert nested set of directories to """

    print('Converting directories in {}'.format(base_dir))

    dirs = glob.glob(os.path.join(base_dir, '*'))
    dirs = {d for d in dirs if os.path.basename(d) in DIRECTORIES}
    if not dirs:
        raise RuntimeError('No direcotries found matching known data.')

    store = pd.HDFStore(
        hdf_name, mode='w', complevel=complevel, complib=complib)

    for dirpath in dirs:
        dirname = os.path.basename(dirpath)

        print(dirname)
        df = cache_to_df(dirpath)

        if dirname == 'travel_data':
            keys = ['from_zone_id', 'to_zone_id']
        elif dirname == 'annual_employment_control_totals':
            keys = ['sector_id', 'year', 'home_based_status']
        elif dirname == 'annual_job_relocation_rates':
            keys = ['sector_id']
        elif dirname == 'annual_household_control_totals':
            keys = ['year']
        elif dirname == 'annual_household_relocation_rates':
            keys = ['age_of_head_max', 'age_of_head_min',
                    'income_min', 'income_max']
        elif dirname == 'building_sqft_per_job':
            keys = ['zone_id', 'building_type_id']
        elif dirname == 'counties':
            keys = ['county_id']
        elif dirname == 'development_event_history':
            keys = ['building_id']
        elif dirname == 'target_vacancies':
            keys = ['building_type_id', 'year']
        else:
            keys = [dirname[:-1] + '_id']

        if dirname != 'annual_household_relocation_rates':
            df = df.set_index(keys)

        for colname in df.columns:
            if df[colname].dtype == np.float64:
                df[colname] = df[colname].astype(np.float32)
            elif df[colname].dtype == np.int64:
                df[colname] = df[colname].astype(np.int32)
            else:
                df[colname] = df[colname]

        df.info()
        print(os.linesep)
        store.put(dirname, df)

    store.close()