def make_general(basis, use_copy=True):
    zero = '0.00000000'
    basis = uncontract_spdf(basis, 0, use_copy)
    for k, el in basis['elements'].items():
        if not 'electron_shells' in el:
            continue
        all_am = []
        for sh in el['electron_shells']:
            if not sh['angular_momentum'] in all_am:
                all_am.append(sh['angular_momentum'])
        all_am = sorted(all_am)
        newshells = []
        for am in all_am:
            newsh = {
                'angular_momentum': am,
                'exponents': [],
                'coefficients': [],
                'region': '',
                'function_type': None,
            }
            for sh in el['electron_shells']:
                if sh['angular_momentum'] != am:
                    continue
                newsh['exponents'].extend(sh['exponents'])
            nprim = len(newsh['exponents'])
            cur_prim = 0
            for sh in el['electron_shells']:
                if sh['angular_momentum'] != am:
                    continue
                if newsh['function_type'] is None:
                    newsh['function_type'] = sh['function_type']
                ft1 = newsh['function_type']
                ft2 = sh['function_type']
                if ft1 not in ft2 and ft2 not in ft1:
                    raise RuntimeError("Cannot make general contraction of different function types")
                ngen = len(sh['coefficients'])
                for g in range(ngen):
                    coef = [zero] * cur_prim
                    coef.extend(sh['coefficients'][g])
                    coef.extend([zero] * (nprim - len(coef)))
                    newsh['coefficients'].append(coef)
                cur_prim += len(sh['exponents'])
            newshells.append(newsh)
        el['electron_shells'] = newshells
    return basis