<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _validate_extra_component(bs_data):
    '''Extra checks for component basis files'''

    assert len(bs_data['elements']) > 0

    # Make sure size of the coefficient matrix matches the number of exponents
    for el in bs_data['elements'].values():
        if not 'electron_shells' in el:
            continue

        for s in el['electron_shells']:
            nprim = len(s['exponents'])
            if nprim <= 0:
                raise RuntimeError("Invalid number of primitives: {}".format(nprim))

            for g in s['coefficients']:
                if nprim != len(g):
                    raise RuntimeError("Number of coefficients doesn't match number of primitives ({} vs {}".format(
                        len(g), nprim))

            # If more than one AM is given, that should be the number of
            # general contractions
            nam = len(s['angular_momentum'])
            if nam > 1:
                ngen = len(s['coefficients'])
                if ngen != nam:
                    raise RuntimeError("Number of general contractions doesn't match combined AM ({} vs {}".format(
                        ngen, nam))