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

def numRegisteredForRoleName(event, roleName):
    '''
    This tag allows one to access the number of registrations
    for any dance role using only the role's name.
    '''
    if not isinstance(event, Event):
        return None

    try:
        role = DanceRole.objects.get(name=roleName)
    except ObjectDoesNotExist:
        return None

    return event.numRegisteredForRole(role)