def get_args():
    """ This function gets settings based on arg_specs.csv
        'schema' file and input file as specified in CLI.
    """
  
    # should probably read system configuration settings here
    
    # get CLI arguments
    argspecs_df     = DB.read_local_csv_to_df(file_path=ARG_SPECS_PATH, user_format=True, silent_error=False)
    argspecs_dod    = utils.df_to_dod(argspecs_df, field='name')    
    cli_argsdict    = get_cli_args_per_argspecs_dod(argspecs_dod, description=DESCRIPTION)

    # job configuration settings
    # input file can be from CLI OR might be provided per API in job folder.
    settings_file_name =  cli_argsdict.get('input')
    
    if settings_file_name:
        # read the settings file and set the value according to the type specified in argspecs_dod.
        inputdict = read_settings_csv_file(
            dirname='input_files', 
            name=settings_file_name, 
            argspecs_dod=argspecs_dod, 
            name_field='argument', 
            value_field='value'
            )
    
        # at this point, inputdict contains arguments passed in input file.
        # cli_argsdict will overwrite those in input file.
        argsdict = {**inputdict, **cli_argsdict}
    else:
        argsdict = cli_argsdict
    
    # now review argspecs to make sure all required records exist and are valid.
    if (not check_args(argsdict, argspecs_dod) or  
        not custom_argsdict_checks(argsdict)):
        sys.exit(1)
    
    return argsdict
def read_argspecs_dod(file_path, field='name', user_format=False, silent_error=False):
    """ read csv file and return dod with primary key being field. 
    """
    df      = DB.read_local_csv_to_df(file_path, user_format=False, silent_error=False)
    dod     = utils.df_to_dod(df, field)    
    return dod
    sns.publish(TopicArn=topic_arn, Message=msg, Subject=sub)


def lambda_handler(event, context):
    updated_klayers = get_updated_klayer()
    message = 'Hi, \n\n There is new version available for following kLayer:\n\n'
    for updated_klayer in updated_klayers:
        update_msg = f"KLayer Name: {updated_klayer['LayerName']}\nNew Version ARN: {updated_klayer['latest_klayer_arn']}\n\n"
        message = message + update_msg

    message = message + '\n\n\n\nYou may consider upgrading them\n\n'
    instructions = "Instructions:\nTo create a layer or update with a new version you can add/update list of packages " \
                   "on a csv file at path 'input_files/layers_manager_input.csv' and run script from directory 'utilities/layers_manager.py' " \
                   "on your local machine. It will scan through the all listed layers and will deploy new if required.\n\n\n\n"

    message = message + instructions
    if len(updated_klayers) > 0:
        publish_to_sns('KLayer New Version Available', message)


if __name__ == "__main__":

    lambda_client = boto3.client('lambda')
    file_path = '../input_files/layers_manager_input.csv'

    input_df = DB.read_local_csv_to_df(file_path,
                                       user_format=True,
                                       silent_error=False)
    for index, row in input_df.iterrows():
        create_update_klayer(lambda_client, row['klayer-arn'], row['package'])