def update_session_number_based_on_key_stage(key_stage_name):
    """
    Defines the correct starting session index based on which key stage is specified.
    :param key_stage_name: Prefix of the specified key stage's session or resource sheets name.
    :return: Returns the appropriate starting session index.
    """
    DEFAULT_KS_STARTING_SESSION_INDEX = 1
    INTERMEDIATE_KS3_STARTING_SESSION_INDEX = 6
    UPPER_KS3_STARTING_SESSION_INDEX = 11
    if (key_stage_name == 'Intermediate_KS3_session_' or key_stage_name ==
        'Intermediate_KS3_S'):
        session_number = INTERMEDIATE_KS3_STARTING_SESSION_INDEX
    elif key_stage_name == 'Upper_KS3_session_' or key_stage_name == 'Upper_KS3_S':
        session_number = UPPER_KS3_STARTING_SESSION_INDEX
    else:
        session_number = DEFAULT_KS_STARTING_SESSION_INDEX
    return session_number
