def check_role(role, meth):
    """
    Verifies that `role` is matched by at least one :mod:`fnmatch`-style
    pattern in `meth`'s RBAC. Raises :class:`RoleError` if no match is found.

    role: string
        Role to be checked.

    meth: method.
        Method to be checked.

    """
    try:
        patterns = meth._rbac[0]
    except __HOLE__:
        raise RoleError('No RBAC for function!')

    for pattern in patterns:
        if fnmatch.fnmatchcase(role, pattern):
            return
    raise RoleError("No access for role '%s'" % role)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/rbac.py/check_role