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

def lookup_basis_by_role(primary_basis, role, data_dir=None):
    '''Lookup the name of an auxiliary basis set given a primary basis set and role

    Parameters
    ----------
    primary_basis : str
        The primary (orbital) basis set that we want the auxiliary
        basis set for. This is not case sensitive.
    role: str
        Desired role/type of auxiliary basis set.
        Use :func:`bse.api.get_roles` to programmatically obtain the available
        formats.  The `fmt` argument is not case sensitive.

        Available roles are

            * jfit
            * jkfit
            * rifit
            * admmfit

    data_dir : str
        Data directory with all the basis set information. By default,
        it is in the 'data' subdirectory of this project.

    Returns
    -------
    str
        The name of the auxiliary basis set for the given primary basis
        and role.
    '''

    data_dir = fix_data_dir(data_dir)

    role = role.lower()

    if not role in get_roles():
        raise RuntimeError("Role {} is not a valid role".format(role))

    bs_data = _get_basis_metadata(primary_basis, data_dir)
    auxdata = bs_data['auxiliaries']

    if not role in auxdata:
        raise RuntimeError("Role {} doesn't exist for {}".format(role, primary_basis))

    return auxdata[role]