Return true if this name is allowed (e.g. not in the forbidden list,
    indicated by 'collection'), false otherwise.

def allowed(name, collection='all'):
    '''
    Return true if this name is allowed (e.g. not in the forbidden list,
    indicated by 'collection'), false otherwise.
    '''

    if not valid(name):
        return False

    blacklist = names()
    for forbidden in blacklist[collection]:
        if name.lower() == forbidden.lower():
            return False
        if forbidden.endswith('*'):
            # very primitive glob matching
            if name.lower().startswith(forbidden[:-1].lower()):
                return False
        if forbidden.startswith('/'):
            # reference to another collection
            if not allowed(name, collection=forbidden[1:]):
                return False

    # No match.
    return True