def sort_basis_dict(bs):
    _keyorder = [
        'molssi_bse_schema', 'schema_type', 'schema_version',
         'jkfit', 'jfit', 'rifit', 'admmfit', 'dftxfit', 'dftjfit',
        'name', 'names', 'aliases', 'flags', 'family', 'description', 'role', 'auxiliaries',
        'notes', 'function_types',
        'reference_description', 'reference_keys',
        'version', 'revision_description',
        'data_source',
        'elements', 'references', 'ecp_electrons',
        'electron_shells', 'ecp_potentials', 'components',
        'function_type', 'region', 'angular_momentum', 'exponents',
        'coefficients',
        'ecp_type', 'angular_momentum', 'r_exponents', 'gaussian_exponents',
        'coefficients'
    ]
    _keyorder.extend([str(x) for x in range(150)])
    bs_sorted = sorted(bs.items(), key=lambda x: _keyorder.index(x[0]))
    if _use_odict:
        bs_sorted = OrderedDict(bs_sorted)
    else:
        bs_sorted = dict(bs_sorted)
    for k, v in bs_sorted.items():
        if isinstance(v, dict):
            bs_sorted[k] = sort_basis_dict(v)
        elif isinstance(v, list):
            bs_sorted[k] = [sort_basis_dict(x) if isinstance(x, dict) else x for x in v]
    return bs_sorted